diff options
author | Igor Babaev <igor@askmonty.org> | 2016-09-06 10:05:36 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2016-09-06 10:05:36 -0700 |
commit | 2d36e5aa38b6943d194e1696761cf357e7d09cca (patch) | |
tree | 2832787d1bb26a057be47bb89aed9589844cb66b | |
parent | 225440047d145bbe6a92bff05c5d4aa33e0aca91 (diff) | |
download | mariadb-git-2d36e5aa38b6943d194e1696761cf357e7d09cca.tar.gz |
Fixed bug mdev-10736 that caused crashes.
The bug manifested itself for recursive definitions that
used anchors over tables with blobs.
-rw-r--r-- | mysql-test/r/cte_recursive.result | 9 | ||||
-rw-r--r-- | mysql-test/t/cte_recursive.test | 10 | ||||
-rw-r--r-- | sql/sql_cte.cc | 3 | ||||
-rw-r--r-- | 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 da5f380c0e4..17a4274f1ca 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 bedbbe6945d..9140cac9da7 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 fa18de0f49f..f6447b29827 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 a0499f2997d..854ebb99ef2 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -237,12 +237,6 @@ select_union_recursive::create_result_table(THD *thd_arg, 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; |