X-Original-To: pgsql-interfaces-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 5929A9FB1EB for ; Fri, 11 Aug 2006 12:52:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 18815-08 for ; Fri, 11 Aug 2006 15:52:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by postgresql.org (Postfix) with ESMTP id 5DD9C9FB259 for ; Fri, 11 Aug 2006 12:52:15 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GBZIr-0001K1-R9 for pgsql-interfaces@postgresql.org; Fri, 11 Aug 2006 17:52:06 +0200 Received: from 213.91.247.173 ([213.91.247.173]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 11 Aug 2006 17:52:05 +0200 Received: from geo_kolev by 213.91.247.173 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 11 Aug 2006 17:52:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-interfaces@postgresql.org From: Georgi Kolev Subject: Re: PQoidValue - get last ID of primary key after INSERT - small Date: Fri, 11 Aug 2006 18:51:01 +0300 Lines: 30 Message-ID: References: <17604.1155235245@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 213.91.247.173 User-Agent: Thunderbird 1.5.0.2 (X11/20060516) In-Reply-To: <17604.1155235245@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.498 tagged_above=0 required=5 tests=RCVD_NUMERIC_HELO, SPF_HELO_PASS, SPF_PASS X-Spam-Level: * X-Archive-Number: 200608/18 X-Sequence-Number: 6232 Hi Tom, Tom Lane wrote: > Georgi Kolev writes: >> The easiest way to fix the problem were to fix heap_insert() to get the >> right value in case there is no OID column declared in the table. > > Not a chance. I could make a list of objections to that that's longer > than your patch, but the short of it is that this is a completely > inappropriate level of the system to be doing that kind of work in. > My basic idea was to implement such functionality as in Sybase and MSSQL Server, I mean the @@identity system variable, which is filled with the identity column of the last INSERT statement executed. I just needed some simple solution to fix the problem. Now it works perfectly for me. > What we *are* working on is INSERT RETURNING (in fact I'm about to start > work on reviewing/committing that patch right now...), which is a much > more general solution to the problem. > > regards, tom lane > I agree that the solution INSERT...RETURNING is more general and flexible. But I think if we have such a solution as @@identity as in Sybase, PostgreSQL will be much more compatible and adoptable for migrations. Regards, Georgi Kolev