mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Add the SQLITE_OMIT_TEMPDB compile time macro. (CVS 2427)
FossilOrigin-Name: c41d55443c2dd532147962b87f542fb7d37075fd
This commit is contained in:
108
test/insert.test
108
test/insert.test
@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the INSERT statement.
|
||||
#
|
||||
# $Id: insert.test,v 1.24 2005/03/21 01:20:58 drh Exp $
|
||||
# $Id: insert.test,v 1.25 2005/03/29 03:11:00 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -227,61 +227,63 @@ do_test insert-4.7 {
|
||||
# Test the ability to insert from a temporary table into itself.
|
||||
# Ticket #275.
|
||||
#
|
||||
do_test insert-5.1 {
|
||||
execsql {
|
||||
CREATE TEMP TABLE t4(x);
|
||||
INSERT INTO t4 VALUES(1);
|
||||
SELECT * FROM t4;
|
||||
}
|
||||
} {1}
|
||||
do_test insert-5.2 {
|
||||
execsql {
|
||||
INSERT INTO t4 SELECT x+1 FROM t4;
|
||||
SELECT * FROM t4;
|
||||
}
|
||||
} {1 2}
|
||||
ifcapable {explain} {
|
||||
do_test insert-5.3 {
|
||||
# verify that a temporary table is used to copy t4 to t4
|
||||
set x [execsql {
|
||||
EXPLAIN INSERT INTO t4 SELECT x+2 FROM t4;
|
||||
}]
|
||||
expr {[lsearch $x OpenTemp]>0}
|
||||
ifcapable tempdb {
|
||||
do_test insert-5.1 {
|
||||
execsql {
|
||||
CREATE TEMP TABLE t4(x);
|
||||
INSERT INTO t4 VALUES(1);
|
||||
SELECT * FROM t4;
|
||||
}
|
||||
} {1}
|
||||
}
|
||||
|
||||
do_test insert-5.4 {
|
||||
# Verify that table "test1" begins on page 3. This should be the same
|
||||
# page number used by "t4" above.
|
||||
#
|
||||
# Update for v3 - the first table now begins on page 2 of each file, not 3.
|
||||
execsql {
|
||||
SELECT rootpage FROM sqlite_master WHERE name='test1';
|
||||
do_test insert-5.2 {
|
||||
execsql {
|
||||
INSERT INTO t4 SELECT x+1 FROM t4;
|
||||
SELECT * FROM t4;
|
||||
}
|
||||
} {1 2}
|
||||
ifcapable {explain} {
|
||||
do_test insert-5.3 {
|
||||
# verify that a temporary table is used to copy t4 to t4
|
||||
set x [execsql {
|
||||
EXPLAIN INSERT INTO t4 SELECT x+2 FROM t4;
|
||||
}]
|
||||
expr {[lsearch $x OpenTemp]>0}
|
||||
} {1}
|
||||
}
|
||||
} [expr $AUTOVACUUM?3:2]
|
||||
do_test insert-5.5 {
|
||||
# Verify that "t4" begins on page 3.
|
||||
#
|
||||
# Update for v3 - the first table now begins on page 2 of each file, not 3.
|
||||
execsql {
|
||||
SELECT rootpage FROM sqlite_temp_master WHERE name='t4';
|
||||
|
||||
do_test insert-5.4 {
|
||||
# Verify that table "test1" begins on page 3. This should be the same
|
||||
# page number used by "t4" above.
|
||||
#
|
||||
# Update for v3 - the first table now begins on page 2 of each file, not 3.
|
||||
execsql {
|
||||
SELECT rootpage FROM sqlite_master WHERE name='test1';
|
||||
}
|
||||
} [expr $AUTOVACUUM?3:2]
|
||||
do_test insert-5.5 {
|
||||
# Verify that "t4" begins on page 3.
|
||||
#
|
||||
# Update for v3 - the first table now begins on page 2 of each file, not 3.
|
||||
execsql {
|
||||
SELECT rootpage FROM sqlite_temp_master WHERE name='t4';
|
||||
}
|
||||
} {2}
|
||||
do_test insert-5.6 {
|
||||
# This should not use an intermediate temporary table.
|
||||
execsql {
|
||||
INSERT INTO t4 SELECT one FROM test1 WHERE three=7;
|
||||
SELECT * FROM t4
|
||||
}
|
||||
} {1 2 8}
|
||||
ifcapable {explain} {
|
||||
do_test insert-5.7 {
|
||||
# verify that no temporary table is used to copy test1 to t4
|
||||
set x [execsql {
|
||||
EXPLAIN INSERT INTO t4 SELECT one FROM test1;
|
||||
}]
|
||||
expr {[lsearch $x OpenTemp]>0}
|
||||
} {0}
|
||||
}
|
||||
} {2}
|
||||
do_test insert-5.6 {
|
||||
# This should not use an intermediate temporary table.
|
||||
execsql {
|
||||
INSERT INTO t4 SELECT one FROM test1 WHERE three=7;
|
||||
SELECT * FROM t4
|
||||
}
|
||||
} {1 2 8}
|
||||
ifcapable {explain} {
|
||||
do_test insert-5.7 {
|
||||
# verify that no temporary table is used to copy test1 to t4
|
||||
set x [execsql {
|
||||
EXPLAIN INSERT INTO t4 SELECT one FROM test1;
|
||||
}]
|
||||
expr {[lsearch $x OpenTemp]>0}
|
||||
} {0}
|
||||
}
|
||||
|
||||
# Ticket #334: REPLACE statement corrupting indices.
|
||||
|
Reference in New Issue
Block a user