The SQLite source code version I’m using is the latest public release version 
3.26.0.

--------------------------------------------------------------------------------------------------------------------------------------

Reproduce steps:

1. Prepare a file data.csv. The content is
a,b,c,d
1,2,3,4
1,2,3,4
1,2,3,4

2. Run this query to import csv data. Only two parameters has been specified: 
filename and header.
CREATE VIRTUAL TABLE temp.t1 USING csv(filename='data.csv', header);
SELECT * FROM t1;

3.
Expected result in Step 2 is
a,b,c,d
1,2,3,4
1,2,3,4
1,2,3,4

Actual result in Step 2 is
a,b,c,d
There’s only header be imported, table content is lost.

--------------------------------------------------------------------------------------------------------------------------------------

I think this issue is caused by this line of code in the file ext/misc/csv.c
(https://www.sqlite.org/cgi/src/artifact/88333dc9f7dcf6a8),

pNew->iStart = ftell(sRdr.in);

which it might should be

pNew->iStart = ftell(sRdr.in) - sRdr.nIn + sRdr.iIn;

And I may wrong about the fixing, but this bug is exists in real.
--------------------------------------------------------------------------------------------------------------------------------------

Best regards.



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to