| OLD | NEW |
| 1 # 2009 April 2 | 1 # 2009 April 2 |
| 2 # | 2 # |
| 3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
| 4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
| 5 # | 5 # |
| 6 # May you do good and not evil. | 6 # May you do good and not evil. |
| 7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
| 8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
| 9 # | 9 # |
| 10 #*********************************************************************** | 10 #*********************************************************************** |
| 11 # | 11 # |
| 12 # Ticket #3773: Be careful not to over-optimize when a compound | 12 # Ticket #3773: Be careful not to over-optimize when a compound |
| 13 # subquery contains an ORDER BY clause. | 13 # subquery contains an ORDER BY clause. |
| 14 # | 14 # |
| 15 # | 15 # |
| 16 # $Id: tkt3773.test,v 1.1 2009/04/02 16:59:47 drh Exp $ | 16 # $Id: tkt3773.test,v 1.1 2009/04/02 16:59:47 drh Exp $ |
| 17 | 17 |
| 18 set testdir [file dirname $argv0] | 18 set testdir [file dirname $argv0] |
| 19 source $testdir/tester.tcl | 19 source $testdir/tester.tcl |
| 20 | 20 |
| 21 ifcapable !compound { |
| 22 finish_test |
| 23 return |
| 24 } |
| 25 |
| 21 do_test tkt3773-1.1 { | 26 do_test tkt3773-1.1 { |
| 22 db eval { | 27 db eval { |
| 23 CREATE TABLE t1(a,b); | 28 CREATE TABLE t1(a,b); |
| 24 INSERT INTO t1 VALUES(2,1); | 29 INSERT INTO t1 VALUES(2,1); |
| 25 INSERT INTO t1 VALUES(33,3); | 30 INSERT INTO t1 VALUES(33,3); |
| 26 CREATE TABLE t2(x,y); | 31 CREATE TABLE t2(x,y); |
| 27 INSERT INTO t2 VALUES(123,2); | 32 INSERT INTO t2 VALUES(123,2); |
| 28 INSERT INTO t2 VALUES(4,4); | 33 INSERT INTO t2 VALUES(4,4); |
| 29 SELECT a FROM ( | 34 SELECT a FROM ( |
| 30 SELECT a, b FROM t1 | 35 SELECT a, b FROM t1 |
| 31 UNION ALL | 36 UNION ALL |
| 32 SELECT x, y FROM t2 | 37 SELECT x, y FROM t2 |
| 33 ORDER BY 2 | 38 ORDER BY 2 |
| 34 ); | 39 ); |
| 35 } | 40 } |
| 36 } {2 123 33 4} | 41 } {2 123 33 4} |
| 37 | 42 |
| 38 finish_test | 43 finish_test |
| OLD | NEW |