X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id EAB7D310177 for ; Fri, 27 Jun 2003 08:45:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 35577-04 for ; Fri, 27 Jun 2003 05:45:16 -0300 (ADT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by svr1.postgresql.org (Postfix) with ESMTP id 647613101CC for ; Fri, 27 Jun 2003 05:45:13 -0300 (ADT) Received: from [212.227.126.155] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 19Vor1-0008Sk-00; Fri, 27 Jun 2003 10:45:11 +0200 Received: from [217.230.192.247] (helo=ecologic.de) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 19Vor0-0001jw-00; Fri, 27 Jun 2003 10:45:10 +0200 Message-ID: <3EFC0413.7090006@ecologic.de> Date: Fri, 27 Jun 2003 10:45:07 +0200 From: Dani Oderbolz User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3.1) Gecko/20030425 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Randall Lucas Cc: pgsql-sql@postgresql.org Subject: Re: Change the behaviour of the SERIAL "Type" References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200306/309 X-Sequence-Number: 14067 Randall Lucas wrote: > > Wow, I had never actually faced this problem (yet) but I spied it as a > possible stumbling block for porting MySQL apps, for which the > standard practice is inserting a NULL. As I have made a fairly > thorough reading of the docs (but may have not cross-correlated every > piece of data yet, obviously), I was surprised to find I hadn't > figured this out myself. It /seems/ obvious in retrospect, but it > really baked my noodle when I first looked at some ugly MySQL queries. > > Respectfully, then, I move that a sentence outlining this > functionality be added to User Manual section 5.1.4, "The Serial > Types." Furthermore, anyone who has written or is writing a MySQL > porting guide should include this, if he hasn't. Yea, fine, but I propose a different (deeper) approach. Why does SERIAL only enforce a DEFAULT? This is not an exact imitation of an autoincrement, as a DEFAULT can be overwritten. In my oppinion, SERIAL should implicitly create a Trigger on the table, which then handles this transparently. Would that be difficult? (I am already writing a Procedure which gets all the info needed out of the Catalog, but my problem is that I need some dynamic statements in there...) Cheers, Dani