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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: martin(at)catalyst(dot)net(dot)nz
Cc: "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 05:37:47
Message-ID: 18400.1077601067@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-sql

"PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org> writes:
> /* 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'));

This is not a bug. The order of evaluation of select-lists and
values-lists is not defined anywhere in the SQL standard, nor promised
anywhere in the Postgres documentation. In fact, we specifically say
here:
http://www.postgresql.org/docs/7.4/static/sql-expressions.html#SYNTAX-EXPRESS-EVAL
that "The order of evaluation of subexpressions is not defined." To do
otherwise would put horrible crimps in our ability to optimize query plans.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Martin Langhoff (Catalyst IT) 2004-02-24 06:46:44 Re: BUG #1083: Insert query reordering interacts badly with
Previous Message Bruno Wolff III 2004-02-24 02:11:17 Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()

Browse pgsql-sql by date

  From Date Subject
Next Message Martin Langhoff (Catalyst IT) 2004-02-24 06:46:44 Re: BUG #1083: Insert query reordering interacts badly with
Previous Message Bruno Wolff III 2004-02-24 02:11:17 Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()