SQLite Forum

Request for change: support item lists with trailing comma
Login

Request for change: support item lists with trailing comma

(1) By doug (doug9forester) on 2020-12-15 06:56:35 [source]

I am generating SQL as part of C++ code generation for my application. I would like to not mess with trailing commas on lists of items in SQL statements. Specifically, I would like SQLITE to support the following syntax for the insert statement (see trailing comma in lists):

insert into tbl(a,b,c,) values(1,2,3,);
In version 3.31, SQLite does not support trailing commas in lists. C++ supports them in enum lists which makes life much easier for code generation. I found that SQLite did not support trailing commas thus:
sqlite> .version
SQLite 3.31.1 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837bb4d6
zlib version 1.2.11
gcc-5.2.0
sqlite> create table x(a,b,c);
sqlite> insert into x(a,b,c) values(1,2,3);
sqlite> select * from x;
1|2|3
sqlite> insert into x(a,b,c,) values(1,2,3);
Error: near ")": syntax error
sqlite> insert into x(a,b,c) values(1,2,3,);
Error: near ")": syntax error
sqlite>

(2) By Gunter Hick (gunter_hick) on 2020-12-15 08:47:15 in reply to 1 [link] [source]

Is there an SQL Standard or any SQL Engine that supports trailing commas in lists?