Search Postgresql Archives

RETURNING clause: how to specifiy column indexes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux