Re: Last ID

From: "Brett W(dot) McCoy" <bmccoy(at)chapelperilous(dot)net>
To: Catalin CIOCOIU <catalin(dot)ciocoiu(at)inpg(dot)fr>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Last ID
Date: 2001-03-02 18:53:24
Message-ID: Pine.LNX.4.30.0103021351090.22539-100000@chapelperilous.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, 2 Mar 2001, Catalin CIOCOIU wrote:

> This method don't encourage using serial data type. Practically, in the
> joined table I can't use "serial" data type for primary key. I nead to
> use sequences by hand.
> The last solution work fine, but I need a variable for store the
> nextval('<seq name>').
>
> There is not a other solution ?

It turns out I was wrong -- using currval is session-based, as Tom Lane
has pointed out. However, still see the notes in the docs on caching
more than one values for each backend. This may or not be pertinent.

-- Brett
http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
While money doesn't buy love, it puts you in a great bargaining position.

In response to

  • Re: Last ID at 2001-03-02 17:20:05 from Catalin CIOCOIU

Browse pgsql-novice by date

  From Date Subject
Next Message Donald Braman 2001-03-02 19:01:01 www.postgresql.org
Previous Message Chuck Kimber 2001-03-02 18:33:58 RE: Last ID