[Commits] 2d36e5aa38b6943d194e1696761cf357e7d09cca Fixed bug mdev-10736 that caused crashes. The bug manifested itself for recursive definitions that used anchors over tables with blobs.

Igor Babaev igor at askmonty.org
Tue Sep 6 20:05:36 EEST 2016


commit 2d36e5aa38b6943d194e1696761cf357e7d09cca
Author: Igor Babaev <igor at askmonty.org>
Commit: Igor Babaev <igor at askmonty.org>

    Fixed bug mdev-10736 that caused crashes.
    The bug manifested itself for recursive definitions that
    used anchors over tables with blobs.
---
 mysql-test/r/cte_recursive.result |    9 +++++++++
 mysql-test/t/cte_recursive.test   |   10 ++++++++++
 sql/sql_cte.cc                    |    3 +++
 sql/sql_union.cc                  |    6 ------
 4 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result
index da5f380..17a4274 100644
--- a/mysql-test/r/cte_recursive.result
+++ b/mysql-test/r/cte_recursive.result
@@ -1623,3 +1623,12 @@ n
 3
 4
 5
+#
+# MDEV-10736: recursive definition with anchor over a table with blob
+#
+CREATE TABLE t1 (f VARCHAR(1024));
+WITH RECURSIVE cte(f) AS
+(SELECT t1.f FROM t1 UNION ALL SELECT cte.f FROM cte) 
+SELECT * FROM cte;
+f
+DROP TABLE t1;
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test
index bedbbe6..9140cac 100644
--- a/mysql-test/t/cte_recursive.test
+++ b/mysql-test/t/cte_recursive.test
@@ -1184,3 +1184,13 @@ drop table t1;
 WITH RECURSIVE cte(n) AS
   ( SELECT n+1 FROM cte WHERE n < 5 UNION SELECT 1 UNION SELECT 1 )
 SELECT * FROM cte;
+
+--echo #
+--echo # MDEV-10736: recursive definition with anchor over a table with blob
+--echo #
+
+CREATE TABLE t1 (f VARCHAR(1024));
+WITH RECURSIVE cte(f) AS
+(SELECT t1.f FROM t1 UNION ALL SELECT cte.f FROM cte) 
+SELECT * FROM cte;
+DROP TABLE t1;
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index fa18de0..f6447b2 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -1301,6 +1301,9 @@ bool With_element::instantiate_tmp_tables()
                               &rec_result->tmp_table_param.recinfo,
                               0))
       return true;
+
+    rec_table->file->extra(HA_EXTRA_WRITE_CACHE);
+    rec_table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
   }
   return false;
 }
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index a0499f2..854ebb9 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -237,12 +237,6 @@ bool select_union::flush()
   for (uint i=0; i < table->s->fields; i++)
     rec_table->field[i]->flags &= ~PART_KEY_FLAG;
 
-  if (create_table)
-  {
-    rec_table->file->extra(HA_EXTRA_WRITE_CACHE);
-    rec_table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
-  }
-
   if (rec_tables.push_back(rec_table))
     return true;
 


More information about the commits mailing list