1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix a problem causing "PRAGMA integrity_check" to disable the xfer

optimization for subsequent VACUUM operations on tables with one or more CHECK
constraints. This could result in VACUUM producing slightly larger database
files.

FossilOrigin-Name: e5bb7db51cdfd8124c60329782798cea398733545594dab55cb892b2a08c4d29
This commit is contained in:
dan
2017-04-04 19:58:54 +00:00
parent 628dfe163f
commit 75f9558808
5 changed files with 103 additions and 27 deletions

View File

@ -15,6 +15,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix insert4
ifcapable !view||!subquery {
finish_test
@ -566,4 +567,36 @@ do_catchsql_test insert4-9.1 {
INSERT INTO t1(x) VALUES(5 COLLATE xyzzy) UNION SELECT 0;
} {1 {no such collation sequence: xyzzy}}
#-------------------------------------------------------------------------
# Check that running an integrity-check does not disable the xfer
# optimization for tables with CHECK constraints.
#
do_execsql_test 10.1 {
CREATE TABLE t8(
rid INTEGER,
pid INTEGER,
mid INTEGER,
px INTEGER DEFAULT(0) CHECK(px IN(0, 1))
);
CREATE TEMP TABLE x(
rid INTEGER,
pid INTEGER,
mid INTEGER,
px INTEGER DEFAULT(0) CHECK(px IN(0, 1))
);
}
do_test 10.2 {
set sqlite3_xferopt_count 0
execsql { INSERT INTO x SELECT * FROM t8 }
set sqlite3_xferopt_count
} {1}
do_test 10.3 {
execsql { PRAGMA integrity_check }
set sqlite3_xferopt_count 0
execsql { INSERT INTO x SELECT * FROM t8 }
set sqlite3_xferopt_count
} {1}
finish_test