Re: currval() in insert statements - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: currval() in insert statements
Date
Msg-id 4996F2EC.5080709@iol.ie
Whole thread Raw
In response to currval() in insert statements  (Onno Molenkamp <onno@flox.org>)
List 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@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

pgsql-general by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: select max from subquery
Next
From: Tom Lane
Date:
Subject: Re: trigger creation error (tsvector_update_trigger)