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

Josh and Tom,

I have checked for typos, rewritten a smaller script and checked the 
table setup (\d gb, see below) and
	$result = $conn->exec(
			"SELECT currval('gb_gb_id_seq');"
			  );

continues to return the error:

	ERROR:  gb_gb_id_seq.currval is not yet defined in this session

I know this script worked in the past, but I have not used it 
recently.  We are running PostgreSQL 7.1.3.  It would be great if 
this would work as I have several scripts which operate in a similar 
manner for different TABLES, but if it won't work I'll work around it.

Suggestions for the best way to get the value for the gb_id after an INSERT?



chlamy_est=> \d gb
                                       Table "gb"
  Attribute |         Type          | 
Modifier                    
-----------+-----------------------+--------------------------------------------------
  gb_id     | integer               | not null default 
nextval('"gb_gb_id_seq"'::text)
  clone_id  | integer               |
  accn      | character varying(12) | not null
  gi        | integer               | not null
Index: gb_pkey

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,

	Chuck

view thread (12+ messages)  latest in thread

Message-ID: <a05111b03b975e0252d02@[152.3.11.193]>
Permalink:  ../a05111b03b975e0252d02@%5B152.3.11.193%5D/
Also on:    postgresql.org/message-id/a05111b03b975e0252d02@[152.3.11.193]

 · 

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: chauser@duke.edu, josh@agliodbs.com, tgl@sss.pgh.pa.us
  Subject: Re: problem fetching currval of sequence
  In-Reply-To: <a05111b03b975e0252d02@[152.3.11.193]>

* 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