diff options
author | drh <drh@noemail.net> | 2004-02-09 14:35:28 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2004-02-09 14:35:28 +0000 |
commit | e2201971ac7aa3964ec9dcb51ede5690ddeb3da7 (patch) | |
tree | f6cd819b41374a499023e979acc4aee03f93b35e /test/misc3.test | |
parent | b20ea9d225dffaf7847a5b17f2edf60d7be6204d (diff) | |
download | sqlite-e2201971ac7aa3964ec9dcb51ede5690ddeb3da7.tar.gz sqlite-e2201971ac7aa3964ec9dcb51ede5690ddeb3da7.zip |
Add test case for ticket #601. (CVS 1215)
FossilOrigin-Name: 096312dacb9eb2f8da3cec1504aef8629b505e7f
Diffstat (limited to 'test/misc3.test')
-rw-r--r-- | test/misc3.test | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/test/misc3.test b/test/misc3.test index 980ec5a74..1ccc92c7d 100644 --- a/test/misc3.test +++ b/test/misc3.test @@ -13,7 +13,7 @@ # This file implements tests for miscellanous features that were # left out of other test files. # -# $Id: misc3.test,v 1.6 2004/01/14 21:59:24 drh Exp $ +# $Id: misc3.test,v 1.7 2004/02/09 14:35:28 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -207,5 +207,34 @@ do_test misc3-4.3 { } } {64} +# Ticket #601: Putting a left join inside "SELECT * FROM (<join-here>)" +# gives different results that if the outer "SELECT * FROM ..." is omitted. +# +do_test misc4-5.1 { + execsql { + CREATE TABLE x1 (b, c); + INSERT INTO x1 VALUES('dog',3); + INSERT INTO x1 VALUES('cat',1); + INSERT INTO x1 VALUES('dog',4); + CREATE TABLE x2 (c, e); + INSERT INTO x2 VALUES(1,'one'); + INSERT INTO x2 VALUES(2,'two'); + INSERT INTO x2 VALUES(3,'three'); + INSERT INTO x2 VALUES(4,'four'); + SELECT x2.c AS c, e, b FROM x2 LEFT JOIN + (SELECT b, max(c) AS c FROM x1 GROUP BY b) + USING(c); + } +} {1 one cat 2 two {} 3 three {} 4 four dog} +do_test misc4-5.2 { + execsql { + SELECT * FROM ( + SELECT x2.c AS c, e, b FROM x2 LEFT JOIN + (SELECT b, max(c) AS c FROM x1 GROUP BY b) + USING(c) + ); + } +} {1 one cat 2 two {} 3 three {} 4 four dog} + finish_test |