1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Have the b-tree layer return SQLITE_CORRUPT to any attempt to open a cursor with a root page number less than 1.

FossilOrigin-Name: aa18c8e9d1676b1caa53bc5f5c1dc5f201089b88
This commit is contained in:
dan
2015-05-25 19:24:36 +00:00
parent 0f8076dd69
commit 08f901b008
4 changed files with 36 additions and 11 deletions

View File

@ -204,5 +204,26 @@ do_test 6.1 {
execsql { DELETE FROM t1 WHERE rowid=2 }
} {}
#-------------------------------------------------------------------------
# See what happens if the sqlite_master entry associated with a PRIMARY
# KEY or UNIQUE index is removed.
#
reset_db
do_execsql_test 7.0 {
CREATE TABLE t1(x PRIMARY KEY, y);
INSERT INTO t1 VALUES('a', 'A');
INSERT INTO t1 VALUES('b', 'A');
INSERT INTO t1 VALUES('c', 'A');
SELECT name FROM sqlite_master;
} {t1 sqlite_autoindex_t1_1}
do_execsql_test 7.1 {
PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE name = 'sqlite_autoindex_t1_1';
}
do_test 7.2 {
db close
sqlite3 db test.db
catchsql { UPDATE t1 SET x='d' AND y='D' WHERE rowid = 2 }
} {1 {database disk image is malformed}}
finish_test