I've implemented a simple fix by manually settings the sequence value
after I do my inserts, but I'm wondering why django/postgresql doesn't
do the right thing.  Has anyone seen this before?


Yeah, this is an annoying postgresql wart. We've run into it enough that we've rolled the fix into the django-admin utility. "django- admin sqlsequencereset <DEFANGED_app>" will print out the statements to fix the sequences.

Well I wouldn't say this has anything to do with a postgresql wart as much as somebody not understanding how sequences work.
A simple setval() would have solved the problem after load.

Joshua D. Drake



Programmatically, you can get at this SQL from the django.core.management.get_sql_sequence_reset() function.

Jacob



--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: PLphp, PLperl - http://www.commandprompt.com/

Reply via email to