pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Charles Hauser <chauser@duke.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: problem fetching currval of sequence
Date: Tue, 6 Aug 2002 11:35:20 -0700
Message-ID: <200208061135.20799.josh@agliodbs.com> (raw)
In-Reply-To: <20611.1028651144@sss.pgh.pa.us>
References: <web-1602018@davinci.ethosmedia.com>
	<20611.1028651144@sss.pgh.pa.us>


Tom,

> 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).

No, back in 7.1.0 I was able to call CURRVAL without having previously called 
NEXTVAL, and it would give me the "current" sequence value; that is, the same 
result value as (NEXTVAL() - 1);   I wouldn't mind having a new function that 
does this; I can understand making a distinction between the pre-session 
CURRVAL, and the general current value.

> 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".

Me, I use functions.


-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco




view thread (12+ messages)  latest in thread

Message-ID: <200208061135.20799.josh@agliodbs.com>
Permalink:  ../200208061135.20799.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200208061135.20799.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, tgl@sss.pgh.pa.us, chauser@duke.edu
  Subject: Re: problem fetching currval of sequence
  In-Reply-To: <200208061135.20799.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox