X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 840CC52A20 for ; Fri, 8 Jul 2005 00:03:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 71508-02 for ; Fri, 8 Jul 2005 03:03:44 +0000 (GMT) Received: from boutiquenumerique.com (boutiquenumerique.com [82.67.9.10]) by svr1.postgresql.org (Postfix) with ESMTP id 116D552A01 for ; Fri, 8 Jul 2005 00:03:41 -0300 (ADT) Received: (qmail 26462 invoked from network); 8 Jul 2005 05:04:05 +0200 Received: from unknown (HELO localhost) (boutiquenumerique-lists@192.168.0.4) by boutiquenumerique.com with SMTP; 8 Jul 2005 05:04:05 +0200 To: "Michael Fuhr" Cc: lmeadors@apache.org, pgsql-sql@postgresql.org Subject: Re: getting back autonumber just inserted References: <42CD6B58.6060508@techevolution.be> <20050707201433.94901.qmail@web41013.mail.yahoo.com> <20050707203715.GA26528@winnie.fuhr.org> <20050707205725.GA28200@winnie.fuhr.org> <20050707224452.GA50696@winnie.fuhr.org> <20050708014950.GA3339@winnie.fuhr.org> Message-ID: Date: Fri, 08 Jul 2005 05:03:37 +0200 From: PFC Organization: =?iso-8859-15?Q?La_Boutique_Num=E9rique?= Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In-Reply-To: <20050708014950.GA3339@winnie.fuhr.org> User-Agent: Opera M2/8.0 (Linux, build 1095) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/56 X-Sequence-Number: 22034 > On Fri, Jul 08, 2005 at 01:56:26AM +0200, PFC wrote: >> >Do you mean with lastval()? Here's what happens: >> >> Hm, interesting, you mean the return value of lastval() also depends >> if you set your constraints to deferred or immediate ? > > My mind's ablank trying to contrive a situation where that would > matter. Can you provide an example? It's rather perverse and farfetched, but what would stop one from putting some insert statements in a function that happens to be called somewhere inside of a check constraint... although one could agree that it's a bit shooting oneself in the foot... > In any case, I simply meant to point out that 8.1's lastval() will > be seductively convenient because you don't have to pass it a > sequence name, but the value it returns might not be the value you > want. It's the first time I see a MySQLism in postgres ! However I like it, cos it might subvert some MySQL users, and provide easy answers to The Weekly Question on the mailing list (ie where is AUTO_INCREMENT) ? I've just noticed that I forgot a close() somewhere hence my data import files missed a few chunks at the end and MySQL said "3 warnings, 0 errors" (if it had failed I would have noticed it a week ago but no, more 0000-00-00:00:00:00 hand pruning for me now). Uh oh, SHOW WARNINGS isn't implemented in that version. There are warnings, but I won't tell you where. Somewhere. Hm... grep logs ? yeah, but the error message doesn't mention the table name... nor what kind of warning it is that is not an error even though half of the row has stayed in an unclosed() file buffer...