From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Charles Hauser <chauser(at)duke(dot)edu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: problem fetching currval of sequence |
Date: | 2002-08-06 16:48:32 |
Message-ID: | 20828.1028652512@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Charles Hauser <chauser(at)duke(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tod McQuillin | 2002-08-06 16:48:58 | Re: SQL syntax |
Previous Message | Charles Hauser | 2002-08-06 16:43:32 | Re: problem fetching currval of sequence |