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

Поиск
Список
Период
Сортировка
От PostgreSQL Bugs List
Тема BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()
Дата
Msg-id 20040224012657.B86E5CF4A21@www.postgresql.com
обсуждение исходный текст
Ответы Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()  (Bruno Wolff III <bruno@wolff.to>)
Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      1083
Logged by:          Martin Langhoff

Email address:      martin@catalyst.net.nz

PostgreSQL version: 7.4

Operating system:   Linux irkutsk 2.4.25-piv-smp-server #1 SMP Fri Feb 20
16:56:47 NZDT 2004 i686 unknown

Description:        Insert query reordering interacts badly with
NEXTVAL()/CURRVAL()

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'));

SELECT * FROM testing;

=== END SQL ===

Output looks like:

 col_a | col_b
-------+-------
     1 |     1
     1 |     2

I was expecting:

 col_a | col_b
-------+-------
     1 |     1
     2 |     2

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: ecpg mapping struct members for indicators incorrectly?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Crash when calling a pl/pgsql function with no row to pass as an argument