b8916be945
constrained by == and IS NULL terms of the WHERE clause. FossilOrigin-Name: b920bb70bb009b7c54e7667544c9810c5ee25e19
98 lines
2.5 KiB
Plaintext
98 lines
2.5 KiB
Plaintext
# 2013-06-14
|
|
#
|
|
# 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 the optimizations that disable
|
|
# ORDER BY clauses work correctly
|
|
#
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
set ::testprefix orderby5
|
|
|
|
# Generate test data for a join. Verify that the join gets the
|
|
# correct answer.
|
|
#
|
|
do_execsql_test 1.1 {
|
|
CREATE TABLE t1(a,b,c);
|
|
CREATE INDEX t1bc ON t1(b,c);
|
|
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT a, b, c FROM t1 WHERE a=0;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 1.2.1 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT a, c, b FROM t1 WHERE a=0;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 1.2.2 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT a, c, b FROM t1 WHERE a='xyz' COLLATE nocase;
|
|
} {/B-TREE/}
|
|
do_execsql_test 1.2.3 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT a COLLATE nocase, c, b FROM t1 WHERE a='xyz';
|
|
} {/B-TREE/}
|
|
do_execsql_test 1.2.4 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT a COLLATE nocase, c, b FROM t1 WHERE a='xyz' COLLATE nocase;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 1.3 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT b, a, c FROM t1 WHERE a=0;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 1.4 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT b, c, a FROM t1 WHERE a=0;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 1.5 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT c, a, b FROM t1 WHERE a=0;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 1.6 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT c, b, a FROM t1 WHERE a=0;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 1.7 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT DISTINCT c, b, a FROM t1 WHERE +a=0;
|
|
} {/B-TREE/}
|
|
do_execsql_test 2.1 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE a=0 ORDER BY a, b, c;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 2.2 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE +a=0 ORDER BY a, b, c;
|
|
} {/B-TREE/}
|
|
do_execsql_test 2.3 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE a=0 ORDER BY b, a, c;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 2.4 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE a=0 ORDER BY b, c, a;
|
|
} {~/B-TREE/}
|
|
do_execsql_test 2.5 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE a=0 ORDER BY a, c, b;
|
|
} {/B-TREE/}
|
|
do_execsql_test 2.6 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE a=0 ORDER BY c, a, b;
|
|
} {/B-TREE/}
|
|
do_execsql_test 2.7 {
|
|
EXPLAIN QUERY PLAN
|
|
SELECT * FROM t1 WHERE a=0 ORDER BY c, b, a;
|
|
} {/B-TREE/}
|
|
|
|
|
|
finish_test
|