X-Original-To: pgsql-bugs-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 204B3D1CAE1 for ; Tue, 24 Feb 2004 10:48:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 71515-02 for ; Tue, 24 Feb 2004 06:48:09 -0400 (AST) Received: from mail2.catalyst.net.nz (godel.catalyst.net.nz [202.49.159.12]) by svr1.postgresql.org (Postfix) with ESMTP id 5A79DD1BA52 for ; Tue, 24 Feb 2004 06:48:06 -0400 (AST) Received: from 202-0-36-112.cable.paradise.net.nz ([202.0.36.112] helo=catalyst.net.nz) by mail2.catalyst.net.nz with asmtp (Cipher TLSv1:RC4-MD5:128) (Exim 3.35 #1 (Debian)) id 1Ava6b-00071J-02; Tue, 24 Feb 2004 23:48:01 +1300 Message-ID: <403B2BD4.1060908@catalyst.net.nz> Date: Tue, 24 Feb 2004 23:47:48 +1300 From: Martin Langhoff User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: PostgreSQL Bugs List Subject: Re: BUG #1083: Insert query reordering interacts badly with References: <20040224012657.B86E5CF4A21@www.postgresql.com> <18400.1077601067@sss.pgh.pa.us> <403AF354.5030901@catalyst.net.nz> <18920.1077605515@sss.pgh.pa.us> In-Reply-To: <18920.1077605515@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-System-Filter-Id: mail2.catalyst.net.nz 1Ava6b-00071J-02 X-Virus-Scanned-By: Amavis with CLAM Anti Virus on mail2.catalyst.net.nz X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/144 X-Sequence-Number: 7932 Tom Lane wrote: >How about > >SELECT nextval('seq'); -- ignore result > >INSERT INTO ... VALUES (currval('seq'), currval('seq')); > > Well, it works for my sample case, I have to agree. Maybe I should mention that I tried to boil down the bugreport to the simplest repro case I could. My actual SQL looks roughly like INSERT INTO destination (record_id, page, row) SELECT (SELECT record_id FROM record ORDERED BY name), (NEXTVAL('seq') / 200), (CURRVAL('seq') % 200) While I have a workaround, I am definitely curious as to whether there is actually a way to do it. Thanks for your patience. regards, martin -- ----------------------------------------------------------------------- Martin @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St OFFICE: +64(4)916-7224 MOB: +64(21)364-017 Make things as simple as possible, but no simpler - Einstein -----------------------------------------------------------------------