SQLite Forum

Columns metadata is invalit for RETURNING clause

Columns metadata is invalit for RETURNING clause

(1) By zdm (zdm001) on 2021-05-05 04:27:43 [link] [source]


Column metadata interfaces such as sqlite3_column_origin_name() and sqlite3_column_decltype() don't work with the RETURNING clause.

Is it possible to fix this?

sqlite version: 3.35.2

(2) By ThanksRyan on 2021-05-05 05:05:29 in reply to 1 [link] [source]


Have you tried SQLite version 3.35.4? It seems some RETURNING things were fixed there:


(By the way, 3.35.5 is the latest release.)

(3) By Keith Medcalf (kmedcalf) on 2021-05-05 05:50:49 in reply to 2 [link] [source]

The current trunk does not return metadata for RETURNING columns either, only the column name.

(4) By zdm (zdm001) on 2021-05-05 05:58:04 in reply to 3 [link] [source]

Yes, but are there any plans to implement this? We want to use queries with RETURNING but our software is depends on column type.

(5) By zdm (zdm001) on 2021-05-16 08:04:02 in reply to 1 [link] [source]

Guys, do you know, will this feature be implemented or not? This is important for me to know. Thank you.

(6) By Harald Hanche-Olsen (hanche) on 2021-05-16 09:44:27 in reply to 5 [source]

My two cents' worth: I think you'd be wise to avoid relying on this feature being implemented soon, if at all. If they plan to implement it for free, they are unlikely to say so before the feature has landed; doing otherwise invites a possibly endless stream of requests for ETAs, with attendant followups when the ETA has passed and the feature isn't implemented yet, effectively turning the ETA into a deadline.

Not that there is anything wrong with asking for features. I've done it myself. Just don't be disappointed if the requested feature doesn't materialise, or it takes much longer than desired to do so.

If the feature truly is important to you, you might consider paying to get it done. See the support page.

(7) By Richard Hipp (drh) on 2021-05-17 19:32:55 in reply to 5 [link] [source]

This is unlikely to be implemented anytime soon.

Because of the way that RETURNING is implemented, metadata about the returned columns is not easily available when the bytecode for the RETURNING clause is generated. A major refactoring will be required to make that information available. Furthermore, the metadata is of limited utility, and it uses CPU cycles to compute and heap space to store, even in the common case where it is never accessed.

So the down-side of adding metadata to RETURNING columns includes:

  • A lot of work for the developers.
  • Probably a whole bunch of new bugs.
  • Additional CPU cycles required to prepare statements with RETURNING clauses, even if the metadata is never accessed.
  • Additional heap memory used by prepared statements with RETURNING clauses, even if the metadata is never accessed.

And there seems to be very little offsetting up-side. In all of the programs I've written in 20 years of using SQLite, I don't recall ever having used the metadata information (except for programs whose purpose is to test the metadata APIs).