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

From Tom Lane
Subject Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()
Date
Msg-id 18920.1077605515@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()  ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>)
Responses Re: BUG #1083: Insert query reordering interacts badly with
List pgsql-bugs
"Martin Langhoff (Catalyst IT)" <martin@catalyst.net.nz> writes:
> Thanks for the clarification. I am curious, however: I can't find a
> means to achieve the same effect in a deterministic manner. Any pointers?

How about

SELECT nextval('seq');       -- ignore result

INSERT INTO ... VALUES (currval('seq'), currval('seq'));

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1083: Insert query reordering interacts badly with NEXTVAL()/CURRVAL()
Next
From: Andreas Pflug
Date:
Subject: Re: BUG #1082: Order by doesn't sort correctly.