SQLite

View Ticket
Login
Ticket Hash: d1d84037b90a44966c67827086526b3bdff22cba
Title: import doesn't work on attached databases due to unnecessary quoting
Status: Fixed Type: Feature_Request
Severity: Important Priority: Immediate
Subsystem: Shell Resolution: Fixed
Last Modified: 2011-09-28 01:11:07
Version Found In: 3.7.8
Description:
Trying to import to an attached database fails.  This is because the code does this:

<verbatim>
  sqlite3_mprintf("SELECT * FROM '%q'", zTable);
  sqlite3_snprintf(... "INSERT INTO '%q' VALUES(?", zTable);
</verbatim>

If you put single quotes around a table name then database names within are not parsed.

<verbatim>
  sqlite> attach '/tmp/foo' as foo;
  sqlite> create table foo.bar(x);
  sqlite> select * from foo.bar;
  sqlite> select * from 'foo.bar';
  SQLError: no such table: foo.bar
</verbatim>

The code should not be using single quotes or SQLite should be changed to parse database names when single quotes are used.