From: Josh Berkus <josh@agliodbs.com>
To: Charles Hauser <chauser@duke.edu>
To: pgsql-sql@postgresql.org
Subject: Re: problem fetching currval of sequence
Date: Tue, 06 Aug 2002 08:45:45 -0700
Message-ID: <web-1602018@davinci.ethosmedia.com> (raw)
In-Reply-To: <a05111b00b97594e67c38@[152.3.11.193]>
Charles,
> I have a script to load values into a table (gb) which contains a
> SEQUENCE ('gb_id'). For each entry into TABLE gb I need the value of
> 'gb_gb_id_seq' to update a relational table. I am getting the
> following error msg:
> ERROR: gb_gb_id_seq.currval is not yet defined in this session.
Sometime in the upgrade process for 7.1.0 --> 7.2.1, the CURRVAL
function changed so that it was rigorously session-specific. I can see
a number of good reasons for doing this, but 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.
I'd love to hear Tom, Bruce, or Stephan's comments on the issue. It is
an annoyance, and it would be nice to know the reason for the decrease
in functionality of CURRVAL.
All that aside, the first query you are sending to Postgres is an
UPDATE query, not an INSERT. So what good was CURRVAL going to do you
anyway?
-Josh Berkus
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, chauser@duke.edu
Subject: Re: problem fetching currval of sequence
In-Reply-To: <web-1602018@davinci.ethosmedia.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