Re: Sequence in PostgreSQL is not updated when doing manual insert

2005-12-01 Thread Joshua D. Drake
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

Re: Sequence in PostgreSQL is not updated when doing manual insert

2005-11-24 Thread pgross
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

Sequence in PostgreSQL is not updated when doing manual insert

2005-11-23 Thread pgross
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');") ...

Re: Sequence in PostgreSQL is not updated when doing manual insert

2005-11-23 Thread Jacob Kaplan-Moss
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