SQLite Forum

csv extension bug ?
Login
Consider the below snippet, pushed via the C api

```c++
const char * sql =
"CREATE VIRTUAL TABLE csv_tab USING "
"csv(header = True, filename = 'c:/tab.csv', "
"schema = 'CREATE TABLE csv_schema ("
"some_date DATE NOT NULL,"
"some_str1 TEXT COLLATE BINARY DEFAULT '',"
"some_str2 TEXT COLLATE BINARY DEFAULT '',"
"some_flt DOUBLE'"
"); ');";
```

as csv does unquoting of its parameters (csv_unquote)
 
the schema used ends up as (line reformatted to illustrate problem)


```sql
CREATE VIRTUAL TABLE csv_tab USING 
csv(header = True, filename = 'c:/tab.csv', 
schema = 'CREATE TABLE csv_schema (
some_date DATE NOT NULL,
some_str1 TEXT COLLATE BINARY DEFAULT ',some_str2 TEXT COLLATE BINARY DEFAULT ',
some_flt DOUBLE
); 
```

And we end up with one less column in the schema and on with incorrect default.

Can be worked around once problem understood but I think that in general only the outer quotes should be processed, not the inner ones.

Many thanks in advance for your feedback