Re: [GENERAL] get the previous assigned sequence value

From: "Dev Elop" <dev(at)archonet(dot)com>
To: <pgsql-general(at)postgreSQL(dot)org>
Subject: Re: [GENERAL] get the previous assigned sequence value
Date: 1999-12-09 10:36:40
Message-ID: 00e301bf4231$4a586140$1001a8c0@client
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hans Reichenecker 1999-12-09 11:51:59 Error: Using Large Objects by perl5-Interface
Previous Message greg 1999-12-09 10:29:31 parse error ???