Search Postgresql Archives

Re: currval() in insert statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Onno Molenkamp <onno@xxxxxxxx> writes:
> 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)

It doesn't work in 8.1 either:

Welcome to psql 8.1.16, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

regression=# create table test (a serial, b int);
NOTICE:  CREATE TABLE will create implicit sequence "test_a_seq" for serial column "test.a"
CREATE TABLE
regression=# insert into test (b) select currval('test_a_seq'::regclass);
ERROR:  currval of sequence "test_a_seq" is not yet defined in this session
regression=# 

There must be something else that you changed about your application.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux