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 C46A252A46 for ; Fri, 8 Jul 2005 00:28:59 -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 84760-05 for ; Fri, 8 Jul 2005 03:28:50 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 08661529C7 for ; Fri, 8 Jul 2005 00:28:49 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j683SeJZ098451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Jul 2005 21:28:42 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j683SeDQ053778; Thu, 7 Jul 2005 21:28:40 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j683Sdks053777; Thu, 7 Jul 2005 21:28:39 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 7 Jul 2005 21:28:39 -0600 From: Michael Fuhr To: PFC Cc: lmeadors@apache.org, pgsql-sql@postgresql.org Subject: Re: getting back autonumber just inserted Message-ID: <20050708032839.GA53708@winnie.fuhr.org> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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/57 X-Sequence-Number: 22035 On Fri, Jul 08, 2005 at 05:03:37AM +0200, PFC wrote: > >On Fri, Jul 08, 2005 at 01:56:26AM +0200, PFC wrote: > >>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... PostgreSQL doesn't support deferral of check constraints, only foreign key constraints. But yeah, if you could do that then presumably lastval() might return a different sequence's value depending on whether the constraints were deferred or immediate. -- Michael Fuhr http://www.fuhr.org/~mfuhr/