But without the quotes you couldn't have the empty string as a field name :) It also allows for spaces etc. and avoids needing logic to find out whether it really needs the quotes or not. And remember that the quotes aren't part of the field name, they're just there in the SQL text. In general though if it's "not a good idea to create a column with that name" then the user shouldn't have named the column that in their .csv file. The shell will at least give an error for duplicate column names if more than 1 column is named the empty string.
sqlite> pragma table_info(Authors); cid,name,type,notnull,dflt_value,pk 0,ID,TEXT,0,,0 1,code,TEXT,0,,0 2,name,TEXT,0,,0 3,sortOrder,TEXT,0,,0 4,,TEXT,0,,0 5,AlternativeName,TEXT,0,,0 sqlite> select ID, code, name, sortOrder, AlternativeName from author; ID code name sortOrder AlternativeName ---------- ---------- ------------------ ------------------- --------------- 1 RAH Robert A. Heinlein Heinlein, Robert A. 2 IA Isaac Asimov Asimov, Isaac 3 HH Harry Harrison Harrison, Harry sqlite> select ID, "" from author; ID ---------- ---------- 1 Real Name 2 Real Name 3 Header line changed to: ID,code,name,,,AlternativeName sqlite> .import authors.txt Authors2 CREATE TABLE Authors2(...) failed: duplicate column name: sqlite> -----Original Message----- From: sqlite-users [mailto:[email protected]] On Behalf Of Simon Slavin Sent: Wednesday, October 04, 2017 12:51 PM To: SQLite mailing list Subject: [sqlite] Shell tool allows creation of column name "" Given a .csv file which starts like this: ID,code,name,sortOrder,,AlternativeName 1,RAH,Robert A. Heinlein,"Heinlein, Robert A.",Real Name, 2,IA,Isaac Asimov,"Asimov, Isaac",Real Name, 3,HH,Harry Harrison,"Harrison, Harry",, Shell tool of this version SQLite version 3.19.3 2017-06-27 16:48:08 Creates a table with the following columns: CREATE TABLE Authors( "ID" TEXT, "code" TEXT, "name" TEXT, "sortOrder" TEXT, "" TEXT, "AlternativeName" TEXT ); I don’t know the externally-governed rules. I don’t know what rules the development team want to follow. But I’m questioning whether it’s a good idea to create a column with that name. If the dev team think it’s okay, that’s fine with me. I would actually prefer it didn’t include the quotes signs in the column names. They’re not in the .csv file. But that’s a different matter. Simon. _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

