RETURNING clause: how to specifiy column indexes? - Mailing list pgsql-general

From Ken Johanson
Subject RETURNING clause: how to specifiy column indexes?
Date
Msg-id 475F7766.2040005@kensystem.com
Whole thread Raw
Responses Re: RETURNING clause: how to specifiy column indexes?
List pgsql-general
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



pgsql-general by date:

Previous
From: "Chris Velevitch"
Date:
Subject: Terminology definitions/meaning
Next
From: Tom Lane
Date:
Subject: Re: Terminology definitions/meaning