pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ross J. Reedstrom <reedstrm@rice.edu>
To: pgsql-sql@postgresql.org
Subject: Re: Question
Date: Wed, 2 Sep 2009 10:28:21 -0500
Message-ID: <20090902152821.GC18170@cooker> (raw)
In-Reply-To: <bebe9cb90909020728we0a60eexa368cb07135896da@mail.gmail.com>
References: <bebe9cb90909020728we0a60eexa368cb07135896da@mail.gmail.com>

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




view thread (19+ messages)  latest in thread

Message-ID: <20090902152821.GC18170@cooker>
Permalink:  ../20090902152821.GC18170@cooker/
Also on:    postgresql.org/message-id/20090902152821.GC18170@cooker

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: reedstrm@rice.edu
  Subject: Re: Question
  In-Reply-To: <20090902152821.GC18170@cooker>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox