"Josh Berkus" <josh@agliodbs.com> writes:
> Sometime in the upgrade process for 7.1.0 --> 7.2.1, the CURRVAL
> function changed so that it was rigorously session-specific.
Huh? AFAIR it's always worked the way it does now (and a quick review
of the CVS logs for sequence.c backs up my recollection).
> ... it has the unfortunate
> side effect that CURRVAL is virtually useless for querying the current
> value of the row you just inserted using a front-end that creates a new
> session for each command.
Such a front end would be too broken to consider using anyway: if you
cannot wrap several related commands into a transaction, you cannot use
a database the way it's intended to be used. The connection-pooling
front ends that I know about all give you dedicated use of a connection
for at least the length of a transaction block, so the secret to using
currval is "do it in the same transaction block as you call nextval in".
regards, tom lane