From 3478d656d0b0894d9de16c03096746185be4489e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Aug 2004 10:22:20 -0700 Subject: 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. sql/sql_yacc.yy: Fixed a typo bug in the rule for join_table. sql/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. mysql-test/t/join_nested.test: Added a test case for bug #4922. mysql-test/r/join_nested.result: Added a test case for bug #4922. --- mysql-test/t/join_nested.test | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'mysql-test/t') 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; -- cgit v1.2.1