diff options
author | unknown <igor@rurik.mysql.com> | 2006-03-29 16:45:29 -0800 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-03-29 16:45:29 -0800 |
commit | 9a02fede24e99c6bfd61830a618ea0086ffe24fb (patch) | |
tree | 7015ecca1a840683624b53321bb98120f0fc23da /mysql-test/r/join_nested.result | |
parent | c5ab0159e19d607246d73951e14cf3d42479c7b9 (diff) | |
download | mariadb-git-9a02fede24e99c6bfd61830a618ea0086ffe24fb.tar.gz |
Fixed bug #18279: crash in the cases when on conditions are moved
out of a nested join to the on conditions for the nest.
The bug happened due to:
1. The function simplify_joins could change on expressions for nested joins.
Yet modified on expressions were not saved in prep_on_expr.
2. On expressions were not restored for nested joins in
reinit_stmt_before_use.
mysql-test/r/join_nested.result:
Added a test case for bug #18279.
mysql-test/t/join_nested.test:
Added a test case for bug #18279.
sql/sql_prepare.cc:
Fixed bug #18279.
On expressions were not restored for nested joins in
reinit_stmt_before_use.
sql/sql_select.cc:
Fixed bug #18279.
The function simplify_joins could change on expressions for nested joins.
Yet modified on expressions were not saved in prep_on_expr.
Diffstat (limited to 'mysql-test/r/join_nested.result')
-rw-r--r-- | mysql-test/r/join_nested.result | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mysql-test/r/join_nested.result b/mysql-test/r/join_nested.result index dfcfa35d31d..0747418111b 100644 --- a/mysql-test/r/join_nested.result +++ b/mysql-test/r/join_nested.result @@ -1504,3 +1504,61 @@ id type cid id pid pid type 1 A NULL NULL NULL NULL NULL DROP VIEW v1; DROP TABLE t1,t2,t3; +CREATE TABLE t1 (id1 int PRIMARY KEY, id2 int); +CREATE TABLE t2 (id1 int PRIMARY KEY, id2 int); +CREATE TABLE t3 (id1 int PRIMARY KEY, id2 int); +CREATE TABLE t4 (id1 int PRIMARY KEY, id2 int); +CREATE TABLE t5 (id1 int PRIMARY KEY, id2 int); +SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa +FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1 +LEFT OUTER JOIN +(t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1) +ON t3.id2 IS NOT NULL +WHERE t1.id1=2; +id ngroupbynsa +PREPARE stmt FROM +"SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa + FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1 + LEFT OUTER JOIN + (t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1) + ON t3.id2 IS NOT NULL + WHERE t1.id1=2"; +EXECUTE stmt; +id ngroupbynsa +EXECUTE stmt; +id ngroupbynsa +EXECUTE stmt; +id ngroupbynsa +EXECUTE stmt; +id ngroupbynsa +INSERT INTO t1 VALUES (1,1), (2,1), (3,2); +INSERT INTO t2 VALUES (2,1), (3,2), (4,3); +INSERT INTO t3 VALUES (1,1), (3,2), (2,NULL); +INSERT INTO t4 VALUES (1,1), (2,1), (3,3); +INSERT INTO t5 VALUES (1,1), (2,2), (3,3), (4,3); +EXECUTE stmt; +id ngroupbynsa +2 1 +2 1 +EXECUTE stmt; +id ngroupbynsa +2 1 +2 1 +EXECUTE stmt; +id ngroupbynsa +2 1 +2 1 +EXECUTE stmt; +id ngroupbynsa +2 1 +2 1 +SELECT t1.id1 AS id, t5.id1 AS ngroupbynsa +FROM t1 INNER JOIN t2 ON t2.id2 = t1.id1 +LEFT OUTER JOIN +(t3 INNER JOIN t4 ON t4.id1 = t3.id2 INNER JOIN t5 ON t4.id2 = t5.id1) +ON t3.id2 IS NOT NULL +WHERE t1.id1=2; +id ngroupbynsa +2 1 +2 1 +DROP TABLE t1,t2,t3,t4,t5; |