Re: Question

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Question
Date: 2009-09-02 15:28:21
Message-ID: 20090902152821.GC18170@cooker
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)rice(dot)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

In response to

  • Question at 2009-09-02 14:28:34 from aymen marouani

Browse pgsql-sql by date

  From Date Subject
Next Message Lew 2009-09-03 00:50:46 Re: Odd sort behaviour
Previous Message Rob Sargent 2009-09-02 15:19:12 Re: Question