3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
12 # This file implements a test for VACUUM on attached databases.
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 set testprefix vacuum6
20 # If the VACUUM statement is disabled in the current build, skip all
21 # the tests in this file.
30 CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
31 INSERT INTO t1 VALUES(1, 1);
41 CREATE INDEX x1 ON t1(x);
42 CREATE INDEX x2 ON t1(x);
43 CREATE INDEX x3 ON t1(x);
44 INSERT INTO t1 SELECT 2,'';
48 #-------------------------------------------------------------------------
51 foreach {tn sz} {1 400 2 4000 3 9999} {
53 do_execsql_test 2.$tn.1 {
54 CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
56 SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100
58 INSERT INTO t1 SELECT i, randomblob($sz) FROM s;
61 do_execsql_test 2.$tn.2 {
65 do_execsql_test 2.$tn.3 {
66 PRAGMA integrity_check;
72 PRAGMA page_size = 1024;
73 CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
74 INSERT INTO t1 VALUES(2, randomblob(1200));
77 PRAGMA page_size = 512;
81 PRAGMA integrity_check
84 #-------------------------------------------------------------------------
88 CREATE TABLE tx(a, b);
89 CREATE INDEX i1 ON tx(b);
91 SELECT 8000 UNION ALL SELECT i+1 FROM s WHERE i<10000
93 INSERT INTO tx SELECT i, randomblob(i) FROM s;
95 SELECT sum(length(b)) FROM tx;
97 foreach {tn pgsz av} {
105 do_execsql_test 4.1.$tn.1 "
106 PRAGMA page_size = $pgsz;
107 PRAGMA auto_vacuum = $av;
109 do_execsql_test 4.1.$tn.2 VACUUM
110 integrity_check 4.1.$tn.3