On 17-12-2018 13:26, Adriano dos Santos Fernandes wrote:
On 09/12/2018 11:55, Mark Rotteveel wrote:
Back in 2012 I created CORE-3808 to request support for RETURNING *,
which should - equivalent to SELECT * - return all columns instead of
having to manually include all columns in the returning clause.

The primary use case for me would be to more easily support the JDBC
getGeneratedKeys functionality, and with better performance than the
current implementation because it would avoid roundtrips to query the
metadata tables. I assume this would also be useful for other drivers or
frameworks that require similar functionality.

For example PostgreSQL already has this (see
https://www.postgresql.org/docs/current/sql-insert.html).


For a table with columns A, B, C, but with command INSERT INTO T (A)
..., should RETURNING * returns A, B, C or just A?

It should return all columns of the table (or view), so A, B and C. In other words, the `*` in a `RETURNING *` would be similar to the `*` in a `SELECT * FROM sometable`, which will also produce all columns from sometable.

This would be for all statement types supporting RETURNING, not just INSERT.

If it would just return the columns referenced in the insert column-list it would not be useful for my needs. The primary use case for me is to return generated columns (identity, trigger populated, default values, etc).

Jaybird currently queries the metadata tables for the table referenced in DML and then adds a RETURNING-clause with all columns of the table. That isn't very efficient. Being able to just add RETURNING * without having to query the metadata tables would be simpler and quicker.

Mark
--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to