3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing that the optimizations that disable
13 # ORDER BY clauses work correctly on multi-value primary keys and
14 # unique indices when only some prefix of the terms in the key are
15 # used. See ticket http://www.sqlite.org/src/info/a179fe74659
19 set testdir [file dirname $argv0]
20 source $testdir/tester.tcl
21 set ::testprefix orderby4
23 # Generate test data for a join. Verify that the join gets the
27 CREATE TABLE t1(a, b, PRIMARY KEY(a,b));
28 INSERT INTO t1 VALUES(1,1),(1,2);
29 CREATE TABLE t2(x, y, PRIMARY KEY(x,y));
30 INSERT INTO t2 VALUES(3,3),(4,4);
31 SELECT a, x FROM t1, t2 ORDER BY 1, 2;
34 SELECT a, x FROM t1 CROSS JOIN t2 ORDER BY 1, 2;
37 SELECT a, x FROM t2 CROSS JOIN t1 ORDER BY 1, 2;
42 INSERT INTO t3 VALUES(1),(1);
43 CREATE INDEX t3a ON t3(a);
45 INSERT INTO t4 VALUES(3),(4);
46 CREATE INDEX t4x ON t4(x);
47 SELECT a, x FROM t3, t4 ORDER BY 1, 2;
50 SELECT a, x FROM t3 CROSS JOIN t4 ORDER BY 1, 2;
53 SELECT a, x FROM t4 CROSS JOIN t3 ORDER BY 1, 2;