You, my friend, rule. That's exactly what I needed to do. I've just recently moved from MySQL and am at the point in which I appreciate Postgresql's strictness, but I am still getting used to it.
On Mar 28, 12:57 pm, "Marty Alchin" <[EMAIL PROTECTED]> wrote: > Given that you say you're working with PG Navicat, I assume you're > using Postgresql as your database. Postgresql has a concept of > sequences, which it uses to generate IDs for auto-generated fields > like Django's AutoField. > > I think what you've done, by copying data in directly, is created > records with the specific IDs that existed in your existing data. > Since Postgresql didn't have to generate these IDs, it probably never > incremented its sequence. So when you add new records, Django doesn't > provide an ID, so Postgresql gets a new one from its sequence, then > bombs out because that new ID already exists. > > Check out the Postgresql docs for ALTER SEQUENCE[1], which you can use > to reset the value to something like the highest ID in your data set > (or the highest plus one, I'm not sure). This way, when a new object > is created, the generated ID won't already be in use. Keep in mind > that you'll have to do this for every sequence that your database uses > to generate IDs, and each one will need to be set to a different > value, depending on what IDs are in the related table. > > Hope that helps. > > -Gul > > [1]http://www.postgresql.org/docs/current/interactive/sql-altersequence.... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---