Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 07C6E632EE5 for ; Wed, 2 Sep 2009 12:36:36 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 46133-05 for ; Wed, 2 Sep 2009 15:36:27 +0000 (UTC) X-Greylist: delayed 00:08:05.295252 by SQLgrey-1.7.6 Received: from mh4.mail.rice.edu (mh4.mail.rice.edu [128.42.199.11]) by mail.postgresql.org (Postfix) with ESMTP id EFC46632F3D for ; Wed, 2 Sep 2009 12:36:27 -0300 (ADT) Received: from mh4.mail.rice.edu (localhost.localdomain [127.0.0.1]) by mh4.mail.rice.edu (Postfix) with ESMTP id BA795370038 for ; Wed, 2 Sep 2009 10:28:21 -0500 (CDT) X-Virus-Scanned: by amavis-2.6.0 at mh4.mail.rice.edu Received: from mh4.mail.rice.edu ([127.0.0.1]) by mh4.mail.rice.edu (mh4.mail.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2S+U+pxLVDkE for ; Wed, 2 Sep 2009 10:28:21 -0500 (CDT) Received: from cooker.cnx.rice.edu (cooker.cnx.rice.edu [168.7.5.70]) by mh4.mail.rice.edu (Postfix) with ESMTP id 8E911370027 for ; Wed, 2 Sep 2009 10:28:21 -0500 (CDT) Received: from reedstrm by cooker.cnx.rice.edu with local (Exim 3.36 #1 (Debian)) id 1Mirkz-0007hl-00 for ; Wed, 02 Sep 2009 10:28:21 -0500 Date: Wed, 2 Sep 2009 10:28:21 -0500 From: "Ross J. Reedstrom" To: pgsql-sql@postgresql.org Subject: Re: Question Message-ID: <20090902152821.GC18170@cooker> Mail-Followup-To: "Ross J. Reedstrom" , pgsql-sql@postgresql.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74, RCVD_IN_DNSWL_MED=-4 X-Spam-Level: X-Archive-Number: 200909/16 X-Sequence-Number: 33081 On Wed, Sep 02, 2009 at 04:28:34PM +0200, aymen marouani wrote: > Hi for all, > What is the possible sources of the SQLState 55000 "OBJECT NOT IN > PREREQUISITE STATE" ? > The error 55000 was triggered when I executed the following query : > "select currval('"BatchTreatment_batch_treatment_id_seq"');" If you execute that (or a similar command) from psql, you'll get a more human friendly error message: repository=# select currval('moduleid_seq'); ERROR: currval of sequence "moduleid_seq" is not yet defined in this session Checking the docs at http://www.postgresql.org/docs/8.3/interactive/functions-sequence.html currval Return the value most recently obtained by nextval for this sequence in the current session. (An error is reported if nextval has never been called for this sequence in this session.) Notice that because this is returning a session-local value, it gives a predictable answer whether or not other sessions have executed nextval since the current session did. So, that sequence has not had 'nextval' called on it in this session. Ross -- Ross Reedstrom, Ph.D. reedstrm@rice.edu Systems Engineer & Admin, Research Scientist phone: 713-348-6166 The Connexions Project http://cnx.org fax: 713-348-3665 Rice University MS-375, Houston, TX 77005 GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE