Thanks for the quick response.  I actually had read that while googling for
a solution...but I didn't understand it.  Now I do...so 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 <[EMAIL PROTECTED]> 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
>
> http://www.postgresql.org/docs/8.3/static/functions-sequence.html
>
>   for further reference.
>
> Oleg.
> --
>     Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
>           Programmers don't die, they just GOSUB without RETURN.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to