There are few minor issues with current implementation of .dump command in the sqld:
It stop after first VIRTUAL TABLE or table with sqlite_ prefix - which is a bug
$> CREATE VIRTUAL TABLE email USING fts5(sender, title, body);
$> CREATE TABLE t ( value );
$> INSERT INTO t VALUES (1), (2);
$> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
PRAGMA writable_schema=ON;
INSERT INTO sqlite_schema(type,name,tbl_name,rootpage,sql) VALUES('table','email','email',0,'CREATE VIRTUAL TABLE email USING fts5(sender, title, body)');
PRAGMA writable_schema=OFF;
COMMIT;
It emit incorrect dump if sqld decides to preserve rowid:
$> CREATE TABLE t ( x INTEGER PRIMARY KEY DESC );
$> INSERT INTO t VALUES (1), (2), (10);
$> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS t ( x INTEGER PRIMARY KEY DESC );
INSERT INTO t(rowid,x) VALUES(1);
INSERT INTO t(rowid,x) VALUES(2);
INSERT INTO t(rowid,x) VALUES(3);
COMMIT;
Context
There are few minor issues with current implementation of
.dump
command in thesqld
:VIRTUAL TABLE
or table withsqlite_
prefix - which is a bugsqld
decides to preserverowid
: