Consider the table I create in SQLite database with CREATE TABLE tbl(x);
which has the following data: INSERT INTO tbl VALUES(1); INSERT INTO tbl VALUES(2);
. Now I wish to create a SQL file of this schema and data that I wish to import into PostgreSQL and I do the following:
.mode insert
.output "tbl.sql"
.schema tbl
select * from tbl order by x;
.output stdout
And the output is:
CREATE TABLE tbl(x);
INSERT INTO table VALUES(1);
INSERT INTO table VALUES(2);
Shouldn't the output of the insert statements be INSERT INTO tbl VALUES(1); INSERT INTO tbl VALUES(2);
?
This is not really a problem because I can easily do a find/repalce to fix this but that might potentially introduce unforeseen problems (like changing data inside the insert statement).
From the fine SQLite manual:
So saying
.mode insert
leaves SQLite to use the default table name which is apparentlytable
. You should be saying: