Hi Andy,
this is AFAIK on a per transaction basis.
HTH
Tino Wildenhain
PS: I often use a plpsql script for creating table entrys, this helps if
you have many foreign keys and need some checks and the last id too. It
looks roughly like this:
CREATE FUNCTION ...
nextid=nextval(''sequence'');
insert into table ... (nextid, ... ) ;
return nextid;
this way you can use the function in another insert, immediately using its
return
value for insert in the other table.
--On Montag, 16. September 2002 18:14 -0400 Andy Kriger
<akriger@greaterthanone.com> wrote:
> I am trying to get the last value updated by an column auto-incrementing
> with nextval(). In MySQL, you'd use LAST_INSERT_ID() - in Postgre,
> currval() appears to do the trick.
>
> Is this maintained on a per-connection basis? For example, user A inserts
> and the nextval() updates to 5, user B does 2 inserts, updating nextval()
> to 7. When user A calls currval() they should get 5 if the updates are
> per-cnx. What does psql do under the hood here?
>
> thx
> a
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html