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 #***********************************************************************
12 # This file implements test cases for the [b65cb2c8d91f6685841d7d1e13b6]
13 # bug: Correct handling of LIMIT and OFFSET on a UNION ALL query where
14 # the right-hand SELECT contains an ORDER BY in a subquery.
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
25 do_execsql_test offset1-1.1 {
27 INSERT INTO t1 VALUES(1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
29 INSERT INTO t2 VALUES(8,'y'),(9,'z'),(6,'w'),(7,'x');
30 SELECT count(*) FROM t1, t2;
33 do_execsql_test offset1-1.2.0 {
36 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
39 do_execsql_test offset1-1.2.1 {
42 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
45 do_execsql_test offset1-1.2.2 {
48 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
51 do_execsql_test offset1-1.2.3 {
54 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
57 do_execsql_test offset1-1.2.4 {
60 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
63 do_execsql_test offset1-1.2.5 {
66 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
69 do_execsql_test offset1-1.2.6 {
72 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
75 do_execsql_test offset1-1.2.7 {
78 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
81 do_execsql_test offset1-1.2.8 {
84 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
87 do_execsql_test offset1-1.2.9 {
90 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
94 do_execsql_test offset1-1.3.0 {
95 SELECT * FROM t1 LIMIT 0;
98 do_execsql_test offset1-1.4.0 {
101 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
104 do_execsql_test offset1-1.4.1 {
107 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
110 do_execsql_test offset1-1.4.2 {
113 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
116 do_execsql_test offset1-1.4.3 {
119 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
122 do_execsql_test offset1-1.4.4 {
125 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
128 do_execsql_test offset1-1.4.5 {
131 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
133 } {2 b 3 c 4 d 5 e 6 w}
134 do_execsql_test offset1-1.4.6 {
137 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
139 } {2 b 3 c 4 d 5 e 6 w 7 x}
140 do_execsql_test offset1-1.4.7 {
143 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
145 } {2 b 3 c 4 d 5 e 6 w 7 x 8 y}
146 do_execsql_test offset1-1.4.8 {
149 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
151 } {2 b 3 c 4 d 5 e 6 w 7 x 8 y 9 z}
152 do_execsql_test offset1-1.4.9 {
155 SELECT * FROM (SELECT x, y FROM t2 ORDER BY y)
157 } {2 b 3 c 4 d 5 e 6 w 7 x 8 y 9 z}