Fix the CLI ".dump" command so that it does not make duplicate

sqlite_sequence table entries as described in
[forum:/forumpost/b1674b56ad|forum thread b1674b56ad].

FossilOrigin-Name: c833f26a6780f919551e50c67d308e96293cec8481899354411d805617481f24
This commit is contained in:
drh
2025-10-30 11:39:49 +00:00
parent cb36dc3f3e
commit c5ff2aa7cf
4 changed files with 61 additions and 9 deletions
+39
View File
@@ -945,6 +945,45 @@ do_test shell1-4.1.6 {
}
# DELETE content of sqlite_sequence prior to repopulating,
# but only if the sqlite_sequence table is non-empty.
# Forum: 2024-10-13T17:10:01z and 2025-10-29T19:38:43z
#
do_test shell1-4.1.7 {
db close
forcedelete test2.db
sqlite3 db test2.db
db eval {
CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
INSERT INTO t1 VALUES(1,2),(20,21),(15,16);
}
catchcmd test2.db {.dump}
} {0 {PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
INSERT INTO t1 VALUES(1,2);
INSERT INTO t1 VALUES(15,16);
INSERT INTO t1 VALUES(20,21);
DELETE FROM sqlite_sequence;
INSERT INTO sqlite_sequence VALUES('t1',20);
COMMIT;}}
do_test shell1-4.1.8 {
db close
forcedelete test2.db
sqlite3 db test2.db
db eval {
CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
INSERT INTO t1 VALUES(1,2),(20,21),(15,16);
CREATE TABLE t2(x,y);
INSERT INTO t2 VALUES(99,88);
DROP TABLE t1;
}
catchcmd test2.db {.dump}
} {0 {PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE t2(x,y);
INSERT INTO t2 VALUES(99,88);
COMMIT;}}
# Test the output of ".mode insert"
#