summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-08-26 14:15:40 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-08-26 14:15:40 +0400
commit08b3c60d2278eba60a13bc409289a807107bcc81 (patch)
treed10c150611af90c3997fe141f32ecf8ae51048c4
parent0012d0d884b5ab8097d3b2fcda3a58dfe0ba6375 (diff)
parent6cf49743e803f7289679f4268a8bc5e988f2d820 (diff)
downloadmariadb-git-08b3c60d2278eba60a13bc409289a807107bcc81.tar.gz
Automerge.
-rw-r--r--mysql-test/r/join.result20
-rw-r--r--mysql-test/t/join.test20
-rw-r--r--sql/sql_select.cc2
3 files changed, 41 insertions, 1 deletions
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index c3c292b2106..9a8b441b363 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -1235,4 +1235,24 @@ ORDER BY t1.a, t1.a LIMIT 1) AS d)
1
1
DROP TABLE t1;
+#
+# Bug #53544: Server hangs during JOIN query in stored procedure called
+# twice in a row
+#
+CREATE TABLE t1(c INT);
+INSERT INTO t1 VALUES (1), (2);
+PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN
+ t1 t2 ON t1.c=t2.c RIGHT JOIN
+ t1 t3 ON t1.c=t3.c
+ GROUP BY f1;";
+EXECUTE stmt;
+f1
+1
+2
+EXECUTE stmt;
+f1
+1
+2
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 6969be6fdc4..73a1ae5eb82 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -897,4 +897,24 @@ GREATEST(t1.a,
DROP TABLE t1;
+--echo #
+--echo # Bug #53544: Server hangs during JOIN query in stored procedure called
+--echo # twice in a row
+--echo #
+
+CREATE TABLE t1(c INT);
+
+INSERT INTO t1 VALUES (1), (2);
+
+PREPARE stmt FROM "SELECT t2.c AS f1 FROM t1 LEFT JOIN
+ t1 t2 ON t1.c=t2.c RIGHT JOIN
+ t1 t3 ON t1.c=t3.c
+ GROUP BY f1;";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index a77c270f709..ed5123817bf 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8885,10 +8885,10 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
/* Flatten nested joins that can be flattened. */
TABLE_LIST *right_neighbor= NULL;
- bool fix_name_res= FALSE;
li.rewind();
while ((table= li++))
{
+ bool fix_name_res= FALSE;
nested_join= table->nested_join;
if (nested_join && !table->on_expr)
{