(New changes in testing look good, so sorry if this is reopening this) If you need column names with a VALUES table, why not just kick the VALUES to the front in a CTE where you can name the fields? Then you don't need a temp table or temp view that you need to remember to drop, and since you usually know what you're putting into the values table right at the start you're not gonna be complicating anything with the CTE.
WITH valueTable (c1, c2) AS (values (1, 2), (3, 4)) SELECT custom_aggregate(c1, c2) FROM valueTable; SQLite version 3.19.3 2017-06-08 14:26:16 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> with valueTable (field1, field2) as (values (1, 2), (3, 4)) select * from valueTable; --EQP-- 0,0,0,SCAN SUBQUERY 1 field1|field2 1|2 3|4 Run Time: real 0.001 user 0.000000 sys 0.000000 sqlite> with valueTable (field1, field2) as (values (1, 2), (3, 4)) select field2, field1 from valueTable; --EQP-- 0,0,0,SCAN SUBQUERY 1 field2|field1 2|1 4|3 Run Time: real 0.001 user 0.000000 sys 0.000000 sqlite> with valueTable (c1, c2, c3) as (values (1, 2, 3), (4, 5, 6)) select max(c1, c3) from valueTable; --EQP-- 0,0,0,SCAN SUBQUERY 1 max(c1, c3) 3 6 Run Time: real 0.006 user 0.000000 sys 0.000000 sqlite> _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users