2797c21639
one test case that currently fails. FossilOrigin-Name: d8b7ab37120ac20e60b6a600cd0e5b34a09cf97a
76 lines
2.2 KiB
Plaintext
76 lines
2.2 KiB
Plaintext
# 2012 August 24
|
|
#
|
|
# 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 that an index may be used as a covering
|
|
# index when there are OR expressions in the WHERE clause.
|
|
#
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
set ::testprefix whereD
|
|
|
|
do_execsql_test 1.1 {
|
|
CREATE TABLE t(i,j,k,m,n);
|
|
CREATE INDEX ijk ON t(i,j,k);
|
|
CREATE INDEX jmn ON t(j,m,n);
|
|
|
|
INSERT INTO t VALUES(3, 3, 'three', 3, 3);
|
|
INSERT INTO t VALUES(2, 2, 'two', 2, 2);
|
|
INSERT INTO t VALUES(1, 1, 'one', 1, 1);
|
|
INSERT INTO t VALUES(4, 4, 'four', 4, 4);
|
|
}
|
|
|
|
do_execsql_test 1.2 {
|
|
SELECT k FROM t WHERE (i=1 AND j=1) OR (i=2 AND j=2);
|
|
} {one two}
|
|
do_execsql_test 1.3 {
|
|
SELECT k FROM t WHERE (i=1 AND j=1) OR (i=2 AND j=2) OR (i=3 AND j=3);
|
|
} {one two three}
|
|
do_execsql_test 1.4 {
|
|
SELECT k FROM t WHERE (i=1 AND j=1) OR (j=2 AND m=2);
|
|
} {one two}
|
|
do_execsql_test 1.5 {
|
|
SELECT k FROM t WHERE (i=1 AND j=1) OR (i=2 AND j=2) OR (j=3 AND m=3);
|
|
} {one two three}
|
|
do_execsql_test 1.6 {
|
|
SELECT k FROM t WHERE (i=1 AND j=1) OR (j=2 AND m=2) OR (i=3 AND j=3);
|
|
} {one two three}
|
|
do_execsql_test 1.7 {
|
|
SELECT k FROM t WHERE (j=1 AND m=1) OR (i=2 AND j=2) OR (i=3 AND j=3);
|
|
} {one two three}
|
|
do_execsql_test 1.8 {
|
|
SELECT k FROM t WHERE (i=1 AND j=1) OR (j=2 AND i=2) OR (i=3 AND j=3);
|
|
} {one two three}
|
|
|
|
do_execsql_test 2.0 {
|
|
CREATE TABLE t1(a,b,c,d);
|
|
CREATE INDEX t1b ON t1(b);
|
|
CREATE INDEX t1c ON t1(c);
|
|
CREATE INDEX t1d ON t1(d);
|
|
CREATE TABLE t2(x,y);
|
|
CREATE INDEX t2y ON t2(y);
|
|
|
|
INSERT INTO t1 VALUES(1,2,3,4);
|
|
INSERT INTO t1 VALUES(5,6,7,8);
|
|
INSERT INTO t2 VALUES(1,2);
|
|
INSERT INTO t2 VALUES(2,7);
|
|
INSERT INTO t2 VALUES(3,4);
|
|
} {}
|
|
do_execsql_test 2.1 {
|
|
SELECT a, x FROM t1 JOIN t2 ON +y=d OR x=7 ORDER BY a, x;
|
|
} {1 3}
|
|
do_execsql_test 2.2 {
|
|
SELECT a, x FROM t1 JOIN t2 ON y=d OR x=7 ORDER BY a, x;
|
|
} {1 3}
|
|
|
|
finish_test
|