Skip site navigation (1) Skip section navigation (2)

Re: error codes

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To:
Cc: Marcin Krawczyk <jankes(dot)mk(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: error codes
Date: 2008-04-17 10:51:12
Message-ID: 48072BA0.1050503@postnewspapers.com.au (view raw or flat)
Thread:
Lists: pgsql-sql
Craig Ringer wrote:
> Marcin Krawczyk wrote:
>> Hi guys. Does anyone know the error code for '/currval of sequence * is
>> not yet defined in this session/' error ? Is there one at all?
> 
> A quick JDBC test program shows:
> 
> ERROR: currval of sequence "customer_id_seq" is not yet defined in this
> session (SQLState: 55000)

I've just realised I've been doing this a stupid way without thinking
about it. Unsurprisingly it turns out that no Java/JDBC snippets are
required. The much, much easier way to find the error code:

$ psql

... blah blah blah ...

test=# \set VERBOSITY verbose
test=# select currval('test_seq');
ERROR:  55000: currval of sequence "test_seq" is not yet defined in this
session
LOCATION:  currval_oid, sequence.c:644

In retrospect it seems kind of obvious - "surely psql must have way to
show this information, maybe I should look at the manual....".

--
Craig Ringer

In response to

pgsql-sql by date

Next:From: Richard HuxtonDate: 2008-04-17 11:01:52
Subject: Re: Error in restore the Database in Postgres
Previous:From: Craig RingerDate: 2008-04-17 10:43:16
Subject: Re: error codes

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group