Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()
Date: 2004-02-24 02:11:17
Message-ID: 20040224021117.GA29715@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

On Mon, Feb 23, 2004 at 21:26:57 -0400,
PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-02-24 05:37:47 Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()
Previous Message Tom Lane 2004-02-24 01:49:10 Re: Crash when calling a pl/pgsql function with no row to pass as an argument

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-02-24 05:37:47 Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()
Previous Message PostgreSQL Bugs List 2004-02-24 01:26:57 BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()