summaryrefslogtreecommitdiff
path: root/mysql-test/t/join_nested.test
diff options
context:
space:
mode:
authorigor@rurik.mysql.com <>2004-08-06 10:22:20 -0700
committerigor@rurik.mysql.com <>2004-08-06 10:22:20 -0700
commitb805d12587fb4d297efd23ebffc5f9ea00cfcf07 (patch)
tree2ebf29b003c8dccb44d4fc2876cb34702cc0d6c1 /mysql-test/t/join_nested.test
parente9507f0e1a19e0e9306aeb93adf15fcf9a0d7709 (diff)
downloadmariadb-git-b805d12587fb4d297efd23ebffc5f9ea00cfcf07.tar.gz
join_nested.result, join_nested.test:
Added a test case for bug #4922. sql_select.cc: Blocked an optimization performed by join_read_const_table when applied to an inner table of a nested outer join. It was done to fix bug #4922. sql_yacc.yy: Fixed a typo bug in the rule for join_table.
Diffstat (limited to 'mysql-test/t/join_nested.test')
-rw-r--r--mysql-test/t/join_nested.test27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test
index 8247a12fc56..8fd3958b509 100644
--- a/mysql-test/t/join_nested.test
+++ b/mysql-test/t/join_nested.test
@@ -700,3 +700,30 @@ SELECT t2.a,t2.b,t3.a1,t3.b
WHERE t2.a = 4 OR (t2.a > 4 AND t3.a1 IS NULL);
DROP TABLE t0,t1,t2,t3,t4,t5,t6,t7,t8,t9;
+
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+CREATE TABLE t3 (a int);
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (2);
+INSERT INTO t3 VALUES (2);
+INSERT INTO t1 VALUES (2);
+
+#check proper syntax for nested outer joins
+
+SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.a=t3.a) ON t1.a=t3.a;
+
+#must be equivalent to:
+
+SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
+
+#check that everything is al right when all tables contain not more than 1 row
+#(bug #4922)
+
+DELETE FROM t1 WHERE a=2;
+SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
+DELETE FROM t2;
+SELECT * FROM t1 LEFT JOIN t2 LEFT JOIN t3 ON t2.a=t3.a ON t1.a=t3.a;
+
+DROP TABLE t1,t2,t3;