Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL() - Mailing list pgsql-bugs

From Bruno Wolff III
Subject Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()
Date
Msg-id 20040224021117.GA29715@wolff.to
Whole thread Raw
In response to BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()  ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>)
List pgsql-bugs
On Mon, Feb 23, 2004 at 21:26:57 -0400,
  PostgreSQL Bugs List <pgsql-bugs@postgresql.org> wrote:
>
> Details:
>
> === SQL ===
>
> CREATE TEMP TABLE testing (col_a integer, col_b integer);
> CREATE TEMP SEQUENCE seq;
>
> /* this statement will produce the expected result */
> INSERT INTO testing (col_a, col_b) VALUES (NEXTVAL('seq'), CURRVAL('seq'));
>
> /* this statement will reverse the order of CURRVAL()/NEXTVAL() to match the
> column order of the table */
> INSERT INTO testing (col_b, col_a) VALUES (NEXTVAL('seq'), CURRVAL('seq'));

I don't think an order of evaluation is guarenteed for INSERT VALUE lists.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Crash when calling a pl/pgsql function with no row to pass as an argument
Next
From: Tom Lane
Date:
Subject: Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()