Re: [GENERAL] get the previous assigned sequence value
Richard Huxton <dev@archonet.com>
From: "Dev Elop" <dev@archonet.com>
To: <pgsql-general@postgreSQL.org>
Date: 1999-12-09T10:36:40Z
Lists: pgsql-general
> > > > After an INSERT, I want to retrieve the value of the sequence I use for > > unique_ids > > ... > > Alternatively, use the currval(mytable_id_seq) function within the same > session immediately after the insert. > With this second method, you'd probably need to beware race conditions. If another process inserts a record into mytable after you do but before you call currval(), then you'll get the wrong value. Not an issue if you've only got one process accessing the table - probably is one if you have two or more. - Richard Huxton