From: Tom Lane <tgl@sss.pgh.pa.us>
To: Charles Hauser <chauser@duke.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: problem fetching currval of sequence
Date: Tue, 06 Aug 2002 12:48:32 -0400
Message-ID: <20828.1028652512@sss.pgh.pa.us> (raw)
In-Reply-To: <a05111b02b975aa9d9743@[152.3.11.193]>
References: <a05111b00b97594e67c38@[152.3.11.193]>
<20533.1028650590@sss.pgh.pa.us>
<a05111b02b975aa9d9743@[152.3.11.193]>
Charles Hauser <chauser@duke.edu> writes:
> Quite right, I did mean to do an INSERT. Changing the script to do
> so though I still get the error:
> ERROR: gb_gb_id_seq.currval is not yet defined in this session.
> foreach $id(sort keys %ACCN) {
> $conn->exec(
> "INSERT INTO gb (clone_id,accn,gi)
> VALUES ( '$ACCN{$id}{clone_id}','$ACCN{$id}{gb}','$ACCN{$id}{gi}')";
> );
> $result = $conn->exec("SELECT currval('gb_gb_id_seq');");
> die $conn->errorMessage unless PGRES_TUPLES_OK eq
> $result->resultStatus;
> $gb_id = $result->fetchrow;
> $ACCN{$id}{gb_id} = $gb_id;
> }
Hmm, that sure looks like it should work. I can only counsel looking
for silly errors (typos, not running the same copy of the script that you
edited, etc). Also double-check that gb.gb_id has the column default
nextval('gb_gb_id_seq') (try psql's "\d gb" command).
regards, tom lane
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: tgl@sss.pgh.pa.us, chauser@duke.edu
Subject: Re: problem fetching currval of sequence
In-Reply-To: <20828.1028652512@sss.pgh.pa.us>
* 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