Thanks for the quick response.  I actually had read that while googling for a solution...but I didn't understand it.  Now I thank you!

Is there some way to get postgres to figure out what to set the next value for each table?  I have 35 tables so doing it by hand doesn't seem like fun.   I guess I could write something in Python, but that seems like a pain too.

Thanks again

On Mon, May 19, 2008 at 12:41 AM, Oleg Broytmann <> wrote:
On Mon, May 19, 2008 at 12:05:45AM -0700, Sam's Lists wrote:
> Now it seems to be working...more or less.  But sqlobject can't figure
> out the next unused id when creating a record.  Instead it seems to be
> starting at 1.  The program then errors out with a
> "psycopg2.IntegrityError: duplicate key value violates unique
> constraint" error.

  Not a problem of SQLObject. PostgreSQL uses sequences for serial
(autoincremented) fields. For a new empty table sequences are automatically
set to start from 1. You have to setup the sequences for all serial fields
if you want to start from a specific value. Do

SELECT setval('sequence_name', value);

  to set the value for the sequence. Read

  for further reference.

    Oleg Broytmann    
          Programmers don't die, they just GOSUB without RETURN.

This email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
sqlobject-discuss mailing list