From johnbr@undefined.com Wed Aug 7 18:41:12 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id DD932475A01 for ; Wed, 7 Aug 2002 14:41:12 -0400 (EDT) Received: from smtprelay6.dc2.adelphia.net (smtprelay6.dc2.adelphia.net [64.8.50.38]) by postgresql.org (Postfix) with ESMTP id 2E2EE475925 for ; Wed, 7 Aug 2002 14:41:12 -0400 (EDT) Received: from johnbr ([68.67.112.141]) by smtprelay6.dc2.adelphia.net (Netscape Messaging Server 4.15 smtprelay6 Dec 7 2001 09:58:59) with SMTP id H0HL8O03.A8R for ; Wed, 7 Aug 2002 14:41:12 -0400 Message-ID: <00fe01c23e41$ca62bca0$0c05050a@johnbr> Reply-To: "John Brothers" From: "John Brothers" To: Subject: getting oid of an INSERT automatically Date: Wed, 7 Aug 2002 14:39:40 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00FB_01C23E20.43001670" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/149 X-Sequence-Number: 8995 This is a multi-part message in MIME format. ------=_NextPart_000_00FB_01C23E20.43001670 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello all, In pgplsql, is there any way to get the oid that is returned from an INS= ERT statement, without doing a 'follow-up' SELECT for the oid? failing that, is this possible in jdbc, odbc or DBI? Thanks, jb ------=_NextPart_000_00FB_01C23E20.43001670 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello all,
 
   In pgplsql, is there any way = to get=20 the oid that is returned from an INSERT statement, without
doing a 'follow-up' SELECT for the=20 oid?
 
   failing that, is this possibl= e in=20 jdbc, odbc or DBI?
 
Thanks,
    jb
 
------=_NextPart_000_00FB_01C23E20.43001670-- From olly@lfix.co.uk Thu Aug 8 13:28:54 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id BC6A4475C06 for ; Thu, 8 Aug 2002 09:28:54 -0400 (EDT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by postgresql.org (Postfix) with ESMTP id 1852C475BEE for ; Thu, 8 Aug 2002 09:28:54 -0400 (EDT) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-35.mail.demon.net with esmtp (Exim 3.36 #2) id 17cnLU-00033j-0U; Thu, 08 Aug 2002 14:28:56 +0100 Received: from localhost ([127.0.0.1] helo=localhost.localdomain ident=olly) by linda.lfix.co.uk with esmtp (Exim 3.35 #1 (Debian)) id 17cnLT-0004uw-00; Thu, 08 Aug 2002 14:28:55 +0100 Subject: Re: getting oid of an INSERT automatically From: Oliver Elphick To: John Brothers Cc: pgsql-sql@postgresql.org In-Reply-To: <00fe01c23e41$ca62bca0$0c05050a@johnbr> References: <00fe01c23e41$ca62bca0$0c05050a@johnbr> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.7 Date: 08 Aug 2002 14:28:54 +0100 Message-Id: <1028813335.31323.50.camel@linda> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/151 X-Sequence-Number: 8997 On Wed, 2002-08-07 at 19:39, John Brothers wrote: > Hello all, > > In pgplsql, is there any way to get the oid that is returned from an INSERT statement, without > doing a 'follow-up' SELECT for the oid? From johnbr@undefined.com Thu Aug 8 19:20:31 2002 Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 69BC2475943 for ; Thu, 8 Aug 2002 15:20:31 -0400 (EDT) Received: from smtprelay7.dc2.adelphia.net (smtprelay7.dc2.adelphia.net [64.8.50.39]) by postgresql.org (Postfix) with ESMTP id A6EEA47591E for ; Thu, 8 Aug 2002 15:20:30 -0400 (EDT) Received: from johnbr ([68.67.112.141]) by smtprelay7.dc2.adelphia.net (Netscape Messaging Server 4.15 smtprelay7 Dec 7 2001 09:58:59) with SMTP id H0JHQ701.K7Q; Thu, 8 Aug 2002 15:20:31 -0400 Message-ID: <00a801c23f10$721cec80$0c05050a@johnbr> From: "John Brothers" To: "Oliver Elphick" Cc: References: <00fe01c23e41$ca62bca0$0c05050a@johnbr> <1028813335.31323.50.camel@linda> Subject: Re: getting oid of an INSERT automatically Date: Thu, 8 Aug 2002 15:18:57 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/155 X-Sequence-Number: 9001 Gee, you'd kinda think I could have read half-a-page down from where I had been looking. I'm an idiot. Thanks, John ----- Original Message ----- From: "Oliver Elphick" To: "John Brothers" Cc: Sent: Thursday, August 08, 2002 9:28 AM Subject: Re: [SQL] getting oid of an INSERT automatically > On Wed, 2002-08-07 at 19:39, John Brothers wrote: > > Hello all, > > > > In pgplsql, is there any way to get the oid that is returned from an INSERT statement, without > > doing a 'follow-up' SELECT for the oid? > > From the Programmers' Guide (PL/pgSQL section): > > 23.5.5. Obtaining result status > > GET DIAGNOSTICS variable = item [ , ... ] ; > > This command allows retrieval of system status indicators. Each item > is a keyword identifying a state value to be assigned to the > specified variable (which should be of the right data type to > receive it). The currently available status items are ROW_COUNT, the > number of rows processed by the last SQL query sent down to the SQL > engine; and RESULT_OID, the Oid of the last row inserted by the most > recent SQL query. Note that RESULT_OID is only useful after an > INSERT query. > > -- > Oliver Elphick Oliver.Elphick@lfix.co.uk > Isle of Wight, UK > http://www.lfix.co.uk/oliver > GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C > ======================================== > "Ye lust, and have not; ye kill, and desire to have, > and cannot obtain; ye fight and war, yet ye have not, > because ye ask not." James 4:2 > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly