Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6007D47656F; Thu, 21 Nov 2002 14:30:20 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 14152476543; Thu, 21 Nov 2002 14:30:16 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gALJUFsX013788; Thu, 21 Nov 2002 14:30:15 -0500 (EST) To: "Thomas O'Connell" Cc: pgsql-hackers@postgresql.org, pgsql-sql@postgresql.org Subject: Re: [HACKERS] [GENERAL] Bug with sequence In-reply-to: References: <7017.1037851915@sss.pgh.pa.us> Comments: In-reply-to "Thomas O'Connell" message dated "Thu, 21 Nov 2002 12:53:46 -0600" Date: Thu, 21 Nov 2002 14:30:14 -0500 Message-ID: <13787.1037907014@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/336 X-Sequence-Number: 10478 "Thomas O'Connell" writes: > It seems worth pointing out, too, that some SQL purists propose not > relying on product-specific methods of auto-incrementing. > I.e., it is possible to do something like: > insert into foo( col, ... ) > values( coalesce( ( select max( col ) from foo ), 0 ) + 1, ... ); > and this is easily placed in a trigger. ... but that approach is entirely unworkable if you want any concurrency of insert operations. (Triggers are a tad product-specific, too :-() regards, tom lane