Index: test/tkt2822.test ================================================================== --- test/tkt2822.test +++ test/tkt2822.test @@ -11,22 +11,22 @@ # # This file is to test that the issues surrounding expressions in # ORDER BY clauses on compound SELECT statements raised by ticket # #2822 have been dealt with. # -# $Id: tkt2822.test,v 1.1 2007/12/10 18:51:48 danielk1977 Exp $ +# $Id: tkt2822.test,v 1.2 2007/12/12 04:38:27 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # Test plan: # -# tkt2820-1.* - Simple identifier as ORDER BY expression. -# tkt2820-2.* - More complex ORDER BY expressions. +# tkt2822-1.* - Simple identifier as ORDER BY expression. +# tkt2822-2.* - More complex ORDER BY expressions. -do_test tkt2820-1.1 { +do_test tkt2822-1.1 { execsql { CREATE TABLE t1(a, b, c); CREATE TABLE t2(c, b, a); INSERT INTO t1 VALUES(1, 2, 3); @@ -34,69 +34,69 @@ } } {} # If an ORDER BY expression matches two different columns, it is an error. # -do_test tkt2820-1.2 { +do_test tkt2822-1.2 { catchsql { SELECT a, b FROM t1 UNION ALL SELECT b, a FROM t2 ORDER BY a; } } {1 {ORDER BY term number 1 is ambiguous}} -do_test tkt2820-1.3 { +do_test tkt2822-1.3 { catchsql { SELECT a, b, c FROM t2 UNION ALL SELECT c, b, a FROM t1 ORDER BY a; } } {1 {ORDER BY term number 1 is ambiguous}} # But not if it matches the same column in two or more of the # compounded SELECT statements. # -do_test tkt2820-1.4 { +do_test tkt2822-1.4 { execsql { SELECT a, b, c FROM t2 UNION ALL SELECT a, b, c FROM t1 ORDER BY a; } } {1 2 3 1 2 3} -do_test tkt2820-1.5 { +do_test tkt2822-1.5 { execsql { SELECT a, b FROM t2 UNION ALL SELECT c, b FROM t1 ORDER BY c; } } {1 2 3 2} # If a match cannot be found in any SELECT, return an error. # -do_test tkt2820-1.6 { +do_test tkt2822-1.6 { catchsql { SELECT * FROM t2 UNION ALL SELECT * FROM t1 ORDER BY d; } } {1 {ORDER BY term number 1 does not match any result column}} -do_test tkt2820-2.1 { +do_test tkt2822-2.1 { execsql { SELECT a+1, b+1 FROM t1 UNION ALL SELECT a, c FROM t2 ORDER BY a+1; } } {1 3 2 3} -do_test tkt2820-2.2 { +do_test tkt2822-2.2 { catchsql { SELECT a+1, b+1 FROM t1 UNION ALL SELECT a, c FROM t2 ORDER BY a+2; } } {1 {ORDER BY term number 1 does not match any result column}} -do_test tkt2820-2.3 { +do_test tkt2822-2.3 { catchsql { SELECT a+1, b+1 FROM t1 UNION ALL SELECT c, a+1 FROM t2 ORDER BY a+1; } } {1 {ORDER BY term number 1 is ambiguous}} -do_test tkt2820-2.4 { +do_test tkt2822-2.4 { execsql { SELECT t1.a, b+1 FROM t1 UNION ALL SELECT c, a+1 FROM t2 ORDER BY a; } } {1 3 3 2} -do_test tkt2820-2.5 { +do_test tkt2822-2.5 { execsql { SELECT t1.a, b+1 FROM t1 UNION ALL SELECT c, a+1 FROM t2 ORDER BY t1.a; } } {1 3 3 2} finish_test