Experimental change to support the covering index optimization for queries with OR terms in the WHERE clause that search a single index more than once.

FossilOrigin-Name: 1dc8c7c741a82bb98a07f3fdb8142d8bc8d8a98b
This commit is contained in:
dan
2012-08-24 10:52:35 +00:00
parent fb0a60819b
commit bfca6a4066
5 changed files with 96 additions and 13 deletions
+36
View File
@@ -0,0 +1,36 @@
# 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);
CREATE INDEX i ON t(i,j,k);
INSERT INTO t VALUES(3, 3, 'three');
INSERT INTO t VALUES(2, 2, 'two');
INSERT INTO t VALUES(1, 1, 'one');
INSERT INTO t VALUES(4, 4, 'four');
}
do_execsql_test 1.2 {
SELECT k FROM t WHERE (i=1 AND j=1) OR (i=2 AND j=2);
} {one two}
finish_test