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 int
Thanks, I didn't notice that function before. Maybe the docs could
specify when and why you'd want to use it, such as my case above.
Paul
In order to load some test data into the database, I'm using the
following code:
from django.core.db import db
cursor = db.cursor()
cursor.execute("insert into cities (id, name) values (1,
'Chicago');")
cursor.execute("insert into cities (id, name) values (2,
'Miami');")
...
On Nov 23, 2005, at 11:15 AM, pgross wrote:
I've tracked down the problem, and it seems that when I do my manual
inserts, the sequence (cities_id_seq) that PostgreSQL uses for primary
keys isn't updated. Therefore, when I try to save my object with
django, the primary key collides with an alrea
4 matches
Mail list logo