Hello,
when importing a .csv file which contains less columns than
specified in the corresponding TABLE's schema, sqlite3.exe
does not import the last column.
Attached You can find a simple test case:
#############################
data.csv:
a,b
d,e
SQLite version 3.8.3.1 2014-02-11 14:52:19
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .separator ,
sqlite> .mode csv
sqlite> .import data.csv test
sqlite> CREATE TABLE test (A NUMERIC, B TEXT, C TEXT);
sqlite> .import data.csv test
data.csv:1: expected 3 columns but found 2 - filling the rest with NULL
data.csv:2: expected 3 columns but found 2 - filling the rest with NULL
sqlite> select * from test;
a,,
d,,
#############################
- Encoding (UTF8, latin1) and line ends (CR, CR LF, LF etc.) do not matter
- the result is the same with a trailing delimiter in data.csv,
e.g. a,b,
d,e,
- tested with different TABLE schemata, always the same result
- tested with sqlite3 3.8.2, 3.8.3.1, OS: Win 7 64 bit
- Is it a bug, my fault, or intended behaviour?
Cheers,
Christoph
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users