summaryrefslogtreecommitdiff
path: root/mysql-test/t/join_outer.test
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2004-10-04 22:26:36 -0700
committerunknown <igor@rurik.mysql.com>2004-10-04 22:26:36 -0700
commitdc25de58e58bf64c82e290b5c625fb68caa82953 (patch)
treec47a3c7624dcde60e441e64b81dc6251c6491495 /mysql-test/t/join_outer.test
parent2f9c7c0b09fd652b1e3523c46973371743782380 (diff)
downloadmariadb-git-dc25de58e58bf64c82e290b5c625fb68caa82953.tar.gz
join_outer.result, join_outer.test:
Added a test case for bug #5896. sql_select.cc: Fixed the problem of ignoring on expressions depending only on outer table when outer table either contains 1 row or is guaranteed to return only 1 row (bug #5896). sql/sql_select.cc: Fixed the problem of ignoring on expressions depending only on outer tables when outer tables either contained 1 row or is guaranteed to return not more than 1 row. (bug #5896). mysql-test/t/join_outer.test: Added a test case for bug #5896. mysql-test/r/join_outer.result: Added a test case for bug #5896.
Diffstat (limited to 'mysql-test/t/join_outer.test')
-rw-r--r--mysql-test/t/join_outer.test27
1 files changed, 26 insertions, 1 deletions
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 0c4c9614d88..9b5fdb924e6 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -3,7 +3,7 @@
#
--disable_warnings
-drop table if exists t1,t2,t3,t4,t5;
+drop table if exists t0,t1,t2,t3,t4,t5;
--enable_warnings
CREATE TABLE t1 (
@@ -501,3 +501,28 @@ select s.*, '*', m.*, (s.match_1_h - m.home) UUX from
order by UUX desc;
drop table t1, t2;
+
+# Test for bug #5896
+
+CREATE TABLE t0 (a0 int PRIMARY KEY);
+CREATE TABLE t1 (a1 int PRIMARY KEY);
+CREATE TABLE t2 (a2 int);
+CREATE TABLE t3 (a3 int);
+INSERT INTO t0 VALUES (1);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1), (2);
+INSERT INTO t3 VALUES (1), (2);
+
+SELECT * FROM t1 LEFT JOIN t2 ON a1=0;
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON a1=0;
+SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
+EXPLAIN SELECT * FROM t1 LEFT JOIN (t2,t3) ON a1=0;
+SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1;
+EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=0 WHERE a0=a1;
+
+INSERT INTO t0 VALUES (0);
+INSERT INTO t1 VALUES (0);
+SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
+EXPLAIN SELECT * FROM t0, t1 LEFT JOIN (t2,t3) ON a1=5 WHERE a0=a1 AND a0=1;
+
+DROP TABLE t0,t1,t2,t3;