Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id ECE159FBC44 for ; Fri, 9 Mar 2007 11:49:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 52128-01-2 for ; Fri, 9 Mar 2007 11:48:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 54A519FBB92 for ; Fri, 9 Mar 2007 11:49:02 -0400 (AST) Received: (qmail 6485 invoked by uid 500); 9 Mar 2007 15:03:32 -0000 Date: Fri, 9 Mar 2007 09:03:32 -0600 From: Bruno Wolff III To: Phillip Smith Cc: pgsql-sql@postgresql.org Subject: Re: [Re: PRIMARY KEY] Message-ID: <20070309150332.GC23704@wolff.to> Mail-Followup-To: Bruno Wolff III , Phillip Smith , pgsql-sql@postgresql.org References: <1173270012.4925.66.camel@phillip-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1173270012.4925.66.camel@phillip-desktop> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.107 tagged_above=0 required=5 tests=AWL, BAYES_50 X-Spam-Level: X-Archive-Number: 200703/112 X-Sequence-Number: 27750 On Wed, Mar 07, 2007 at 23:20:12 +1100, Phillip Smith wrote: > If you actually need to know the value of N_GEN in your ASP application, > you will need to query the database first and select the NEXTVAL from > the sequence that the "serial" data type will create, then use that > returned value in your insert - ie, DON'T exclude it from the insert, > otherwise it will default to NEXTVAL again and return a different value. In 8.2, you can also use the RETURNING clause to get those values.