Re: currval() in insert statements

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Onno Molenkamp <onno(at)flox(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: currval() in insert statements
Date: 2009-02-14 16:35:56
Message-ID: 4996F2EC.5080709@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 14/02/2009 11:25, Onno Molenkamp wrote:
> I recently upgraded a database from 8.1.11 to 8.3.6, and I noticed the
> following statement stopped working:
>
> insert into test (b) select currval('test_a_seq'::regclass)

I don't think this was ever guaranteed to work - the docs say pretty
clearly that nextval() has to be called before currval() can be expected
to be defined. My feeling is that is was just good fortune that it
worked for you before.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-02-14 16:36:09 Re: trigger creation error (tsvector_update_trigger)
Previous Message Carlos Henrique Reimer 2009-02-14 16:34:30 Track a function