Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 1D6FA2E00EA for ; Thu, 13 Dec 2007 03:17:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 80659-01 for ; Thu, 13 Dec 2007 03:17:37 -0400 (AST) Received: from www01.kensystem.com (www01.kensystem.com [72.19.170.120]) by postgresql.org (Postfix) with ESMTP id D05AD2E00E5 for ; Thu, 13 Dec 2007 03:17:39 -0400 (AST) Received: from 192.168.0.3 by www01.kensystem.com (SMTPD); id s20071213001738.55560; Thu, 13 Dec 2007 00:17:38 Message-ID: <4760DC91.8090103@kensystem.com> Date: Thu, 13 Dec 2007 00:17:37 -0700 From: Ken Johanson User-Agent: Thunderbird 1.5.0.13 (Windows/20070809) MIME-Version: 1.0 To: Kris Jurka , pgsql-general@postgresql.org Subject: Re: RETURNING clause: how to specifiy column indexes? References: <22a9f7570703301215y44a937d0r5faa706bad7948c@mail.gmail.com> <4610AA0C.30608@ejurka.com> <47579D44.6060005@kensystem.com> <47579FBE.1070503@kensystem.com> <475F7766.2040005@kensystem.com> <12796.1197439644@sss.pgh.pa.us> <4760D33E.40004@kensystem.com> In-Reply-To: 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/875 X-Sequence-Number: 125618 > >> If true, my next idea would be to derive the column name using a >> subquery in the returning clause. But it sounds like this may have >> potential security contraints (will any INSERT query always have read >> access to the PG tables?). And no guarantee of the order matching in >> the long term. > > There is no requirement that insert permission on a user table implies > read access to pg_catalog. Still many clients will break if they can't > read pg_catalog. For example, all of the JDBC driver's MetaData results > need to query pg tables, updatable ResultSets need to query pg tables to > know what the primary key is and so on. So if this functionality > required access to pg_catalog that would neither be unprecedented nor > unreasonable. > So it sounds like this may be the best approach, do you agree? I'll try and find the cycles to code this up although the limited value of getGeneratedKeys by index makes me think my time would be better spent elsewhere on the JDBC driver. For now at least. If you can respond to my earlier query (5 Dec) about what robustness improvements are needed, I'll start there.. Thanks, Ken