OLD | NEW |
(Empty) | |
| 1 # 2012 April 02 |
| 2 # |
| 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: |
| 5 # |
| 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. |
| 9 # |
| 10 #*********************************************************************** |
| 11 # The tests in this file were used while developing the SQLite 4 code. |
| 12 # |
| 13 set testdir [file dirname $argv0] |
| 14 source $testdir/tester.tcl |
| 15 set testprefix tkt-385a5b56b9 |
| 16 |
| 17 do_execsql_test 1.0 { |
| 18 CREATE TABLE t1(x, y); |
| 19 INSERT INTO t1 VALUES(1, NULL); |
| 20 INSERT INTO t1 VALUES(2, NULL); |
| 21 INSERT INTO t1 VALUES(1, NULL); |
| 22 } |
| 23 |
| 24 do_execsql_test 1.1 { SELECT DISTINCT x, y FROM t1 } {1 {} 2 {}} |
| 25 do_execsql_test 1.2 { CREATE UNIQUE INDEX i1 ON t1(x, y) } |
| 26 do_execsql_test 1.3 { SELECT DISTINCT x, y FROM t1 } {1 {} 2 {}} |
| 27 |
| 28 |
| 29 #------------------------------------------------------------------------- |
| 30 |
| 31 do_execsql_test 2.0 { |
| 32 CREATE TABLE t2(x, y NOT NULL); |
| 33 CREATE UNIQUE INDEX t2x ON t2(x); |
| 34 CREATE UNIQUE INDEX t2y ON t2(y); |
| 35 } |
| 36 |
| 37 do_eqp_test 2.1 { SELECT DISTINCT x FROM t2 } { |
| 38 0 0 0 {SCAN TABLE t2 USING COVERING INDEX t2x} |
| 39 } |
| 40 |
| 41 do_eqp_test 2.2 { SELECT DISTINCT y FROM t2 } { |
| 42 0 0 0 {SCAN TABLE t2 USING COVERING INDEX t2y} |
| 43 } |
| 44 |
| 45 do_eqp_test 2.3 { SELECT DISTINCT x, y FROM t2 WHERE y=10 } { |
| 46 0 0 0 {SEARCH TABLE t2 USING INDEX t2y (y=?)} |
| 47 } |
| 48 |
| 49 do_eqp_test 2.4 { SELECT DISTINCT x, y FROM t2 WHERE x=10 } { |
| 50 0 0 0 {SEARCH TABLE t2 USING INDEX t2x (x=?)} |
| 51 } |
| 52 |
| 53 finish_test |
OLD | NEW |