Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manage.py loaddata crashes with postgres when filling id column of cms_placeholder #3193

Closed
fp4code opened this issue May 24, 2014 · 4 comments

Comments

@fp4code
Copy link

fp4code commented May 24, 2014

See Arkestra #122 evildmp/Arkestra#122

When the database used is PostgreSQL, the command "manage.py loaddata example_database.json" crashes if the file "example_database.json" contains the block
{
"pk": 1,
"model": "cms.placeholder",
"fields": {
"slot": "body",
"default_width": null
}
},
The crash occurs in the the method Page.rescan_placeholders() (file cms/models/pagemodel.py) because it fills an autoindexed row with an index not taking into account the already filled rows. The problem is clearly decribed here:
http://jesiah.net/post/23173834683/postgresql-primary-key-syncing-issues
and a possible workaround is to insert:
from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT setval('cms_placeholder_id_seq', (SELECT MAX(id) FROM cms_placeholder)+1)")
But a better way can be certainly found.

@yakky
Copy link
Member

yakky commented May 24, 2014

Which version of django CMS are you using?

@fp4code
Copy link
Author

fp4code commented May 24, 2014

I'am using an old one: django-cms==2.3.5, as required by Arkestra.
I will do tests with newer versions.

@yakky
Copy link
Member

yakky commented May 24, 2014

It should be fixed in 2.3.8
@evildmp very little has changed from 2.3.5 to 2.3.8, an upgrade should be feasible, right?

@fp4code
Copy link
Author

fp4code commented May 24, 2014

Sorry, for not for not noticing issue #1031 and commit 00aada0:
"Don't rescan_placeholders when loading fixtures, Fixes #1031".

@fp4code fp4code closed this as completed May 24, 2014
staaas added a commit to kinaklub/filmfest.by that referenced this issue Oct 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants