Re: Last ID Problem - Mailing list pgsql-novice

From Mitch Pirtle
Subject Re: Last ID Problem
Date
Msg-id 330532b605013117551658dd1d@mail.gmail.com
Whole thread Raw
In response to Re: Last ID Problem  (Michael Fuhr <mike@fuhr.org>)
Responses Re: Last ID Problem  (Michael Fuhr <mike@fuhr.org>)
List pgsql-novice
On Mon, 31 Jan 2005 18:38:55 -0700, Michael Fuhr <mike@fuhr.org> wrote:
>
> Contrary to what another message in this thread says, it is indeed
> common practice to do the insert first and call currval() afterwards
> to find out what value you got from the sequence.  And no, this
> doesn't introduce a race condition -- currval() returns the last
> value obtained from the sequence in the current session.

Tell that to the maintainers of PEAR's DB, which is installed by
default with all recent versions of PHP (that would be all of them). I
felt the exact same way as you did, and spent an afternoon
rediscovering the joys of sequence values until one of the maintainers
pointed out that behavior. I even tried to convince them that this was
a bug ('inappropriate behavior' was the term IIRC)...

'Common', unfortunately, is relative; and in this matter might only
apply to ADOdb ;-)

-- Mitch, getting his PHP database classes all mixed up *gasp*

pgsql-novice by date:

Previous
From: "Mike G."
Date:
Subject: Re: pgAdminIII and User Grants
Next
From: Alexander Borkowski
Date:
Subject: Re: pgAdminIII and User Grants