sqlite/test/whereL.test
drh 660ee55663 Initial implementation of the WHERE-clause constant propagation optimization.
FossilOrigin-Name: 2fb82ad8ebb6434438c0d235b1239444fb08c8711cea2c5a9ed955fedd0acdec
2018-07-26 21:16:53 +00:00

40 lines
1.2 KiB
Plaintext

# 2018-07-26
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The
# focus of this file is testing the WHERE-clause constant propagation
# optimization.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set ::testprefix whereL
do_execsql_test 100 {
CREATE TABLE t1(a INT PRIMARY KEY, b, c, d, e);
CREATE TABLE t2(a INT PRIMARY KEY, f, g, h, i);
CREATE TABLE t3(a INT PRIMARY KEY, j, k, l, m);
CREATE VIEW v4 AS SELECT * FROM t2 UNION ALL SELECT * FROM t3;
}
do_eqp_test 110 {
SELECT * FROM t1, v4 WHERE t1.a=?1 AND v4.a=t1.a;
} {
QUERY PLAN
|--MATERIALIZE xxxxxx
| `--COMPOUND QUERY
| |--LEFT-MOST SUBQUERY
| | `--SEARCH TABLE t2 USING INDEX sqlite_autoindex_t2_1 (a=?)
| `--UNION ALL
| `--SEARCH TABLE t3 USING INDEX sqlite_autoindex_t3_1 (a=?)
|--SCAN SUBQUERY xxxxxx
`--SEARCH TABLE t1 USING INDEX sqlite_autoindex_t1_1 (a=?)
}
finish_test