1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Make sure the rootpage values in the symbol table are correctly updated

when dropping tables and indices in autocommit mode.  Ticket #1728. (CVS 3150)

FossilOrigin-Name: 1c582dd11304f4421da2fa451f52b313b541270e
This commit is contained in:
drh
2006-03-24 03:36:26 +00:00
parent d698bc15ef
commit 6205d4a47b
4 changed files with 54 additions and 13 deletions

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the SELECT statement.
#
# $Id: autovacuum.test,v 1.21 2006/03/23 23:29:04 drh Exp $
# $Id: autovacuum.test,v 1.22 2006/03/24 03:36:26 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -538,4 +538,37 @@ do_test autovacuum-5.1 {
}
} ok
# Ticket #1728.
#
# In autovacuum mode, when tables or indices are deleted, the rootpage
# values in the symbol table have to be updated. There was a bug in this
# logic so that if an index/table was moved twice, the second move might
# not occur. This would leave the internal symbol table in an inconsistent
# state causing subsequent statements to fail.
#
# The problem is difficult to reproduce. The sequence of statements in
# the following test are carefully designed make it occur and thus to
# verify that this very obscure bug has been resolved.
#
do_test autovacuum-6.1 {
db close
sqlite3 db :memory:
db eval {
PRAGMA auto_vacuum=1;
CREATE TABLE t1(a, b);
CREATE INDEX i1 ON t1(a);
CREATE TABLE t2(a);
CREATE INDEX i2 ON t2(a);
CREATE TABLE t3(a);
CREATE INDEX i3 ON t2(a);
CREATE INDEX x ON t1(b);
DROP TABLE t3;
PRAGMA integrity_check;
DROP TABLE t2;
PRAGMA integrity_check;
DROP TABLE t1;
PRAGMA integrity_check;
}
} {ok ok ok}
finish_test