Skip site navigation (1) Skip section navigation (2)

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 Langhoff (Catalyst IT)" <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 06:51:55
Message-ID: 18920.1077605515@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-sql
"Martin Langhoff (Catalyst IT)" <martin(at)catalyst(dot)net(dot)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

In response to

Responses

pgsql-bugs by date

Next:From: Gary WANDate: 2004-02-24 10:07:46
Subject: The syntax about CREATE DOMAIN
Previous:From: Martin Langhoff (Catalyst IT)Date: 2004-02-24 06:46:44
Subject: Re: BUG #1083: Insert query reordering interacts badly with

pgsql-sql by date

Next:From: George A.JDate: 2004-02-24 10:02:00
Subject: Enterprice support in PostgreSQL
Previous:From: Martin Langhoff (Catalyst IT)Date: 2004-02-24 06:46:44
Subject: Re: BUG #1083: Insert query reordering interacts badly with

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group