Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 16B722E013E for ; Wed, 12 Dec 2007 01:53:52 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 48952-03 for ; Wed, 12 Dec 2007 01:53:48 -0400 (AST) Received: from www01.kensystem.com (www01.kensystem.com [72.19.170.120]) by postgresql.org (Postfix) with ESMTP id B1F322E010B for ; Wed, 12 Dec 2007 01:53:48 -0400 (AST) Received: from 192.168.0.3 by www01.kensystem.com (SMTPD); id s20071211225342.47675; Tue, 11 Dec 2007 22:53:42 Message-ID: <475F7766.2040005@kensystem.com> Date: Tue, 11 Dec 2007 22:53:42 -0700 From: Ken Johanson User-Agent: Thunderbird 1.5.0.13 (Windows/20070809) MIME-Version: 1.0 CC: pgsql-general@postgresql.org Subject: RETURNING clause: how to specifiy column indexes? References: <22a9f7570703301215y44a937d0r5faa706bad7948c@mail.gmail.com> <4610AA0C.30608@ejurka.com> <47579D44.6060005@kensystem.com> <47579FBE.1070503@kensystem.com> In-Reply-To: <47579FBE.1070503@kensystem.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/699 X-Sequence-Number: 125442 I am attempting to implement (in a driver)(PG JDBC) support for specifying which column indexes (that generated keys) to return, so I'm searching for a way to get the server to return the values of the columns by their index, not name. By name, it is simply to append the RETURNING clause and column names to the query: INSERT... RETURNING foo,bar Does anyone know how (if) this is possible by index? A standard or server-specific syntax is fine since this is being implemented in a server-driver. Something like?: INSERT... RETURNING [1],[2] (obviously this will not work) Would I otherwise need to?: INSERT... RETURNING * then extract the user-requested columns? This seems inefficient as it returns all columns / non-key ones (blobs etc). While the values of an API that specifies the table's columns by ordinaility may seem dubious, it is an API that I think should be implemented anyway. Thanks, Ken