On Apr 3, 10:28 pm, "Jon Ballard" <[EMAIL PROTECTED]> wrote: > Hello everybody, I'm new. Django is the bomb.. my app is coming > together quickly. > > Now to my issue.. > > I dumped my database to json and tried to ingest it back in. Seemed > to work fine at first -- everything was there -- but it turns out no > new records can be added because the sequence field 'last_value' for > all the auto primary keys was left at 1, despite many records being > added to the respective tables. Now I tend to think this might > actually be an issue with Psycopg, but why would it manifest itself > only when using loaddata? > > My setup: > Django 0.96 > Ubuntu 6.10 (Edgy) > PostgreSQL 8.1.8-0ubuntu6.10 > Psycopg 1.1.21-7 > > This is the error when trying to add a new record: > IntegrityError at /admin/spots/spot/add/ > ERROR: duplicate key violates unique constraint "spots_spot_pkey" > INSERT INTO "spots_spot" > > Anyone have any ideas? Am I doing something wrong perhaps? Thanks > for any help. > > I'll continue to research of course.. > > -Jon
I think you can fix it by running something like: $ python manage.py sqlsequencereset | psql mydbname When you load data with the primary keys already set it doesn't update the postgres sequence generator. There's a ticket about how this affects fixture loading: http://code.djangoproject.com/ticket/3790 Zach --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---