Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 436D12E002D for ; Thu, 17 Apr 2008 06:52:05 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 10773-09 for ; Thu, 17 Apr 2008 06:51:56 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.61.230.242]) by developer.postgresql.org (Postfix) with ESMTP id 09AD92E0056 for ; Thu, 17 Apr 2008 06:51:55 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id D92D35A9; Thu, 17 Apr 2008 17:51:48 +0800 (WST) Received: from [10.0.0.53] (wallace.localnet [10.0.0.53]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 22EC61E0434; Thu, 17 Apr 2008 17:51:52 +0800 (WST) Message-ID: <48072BA0.1050503@postnewspapers.com.au> Date: Thu, 17 Apr 2008 18:51:12 +0800 From: Craig Ringer User-Agent: Icedove 1.5.0.12 (X11/20070607) MIME-Version: 1.0 Cc: Marcin Krawczyk , pgsql-sql@postgresql.org Subject: Re: error codes References: <95f6bf9b0804170123w271df42er3b377c1b9a3f0244@mail.gmail.com> <480729C4.7040802@postnewspapers.com.au> In-Reply-To: <480729C4.7040802@postnewspapers.com.au> X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.278 tagged_above=0 required=5 tests=AWL=-1.303, MISSING_HEADERS=1.581 X-Spam-Level: X-Archive-Number: 200804/112 X-Sequence-Number: 30651 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