Thank you both for the suggestions. There is a problem with the sequence number in the primary keys. When I created a new table without data the insert worked fine. I will try to recreate the sequences and hope I don't have to re-enter the data.
Thanks, Anna On Dec 12, 3:26 am, tofer...@gmail.com wrote: > On 11.12-07:45, Ana wrote: > > [ ... ] > > > I am converting from PHP to Django. In my Postgres database I have > > three tables: > [ ... ] > > duplicate key value violates unique constraint > > "fsafety_pathpubcombo_pkey" > > > Can anyone please help? This is the first python code I've written. > > i would guess that you need to reset your postgres autoindex to > something that matches your dataset. for example if you have 10,000 > records then the primary keys for 1-10,000 are already duplicate, > however, with your a database the index key will be set to something > low, thereby inducing the collisions you're talking about. > > you'll need to do this via 'psql' or another postgres tool. i'm > afraid i can't remember the way do to this. maybe it's to delete > the underlying sequence and then recreate it with > CREATE SEQUENCE <thenameofthe_seq> START <highest_id+1> ; > or something. i don't think you can set it directly ... if i > remember correctly i backed up a db to sql and figured it out that > way. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---