Commit 2d36e5aa authored by Igor Babaev's avatar Igor Babaev

Fixed bug mdev-10736 that caused crashes.

The bug manifested itself for recursive definitions that
used anchors over tables with blobs.
parent 22544004
...@@ -1623,3 +1623,12 @@ n ...@@ -1623,3 +1623,12 @@ n
3 3
4 4
5 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;
...@@ -1184,3 +1184,13 @@ drop table t1; ...@@ -1184,3 +1184,13 @@ drop table t1;
WITH RECURSIVE cte(n) AS WITH RECURSIVE cte(n) AS
( SELECT n+1 FROM cte WHERE n < 5 UNION SELECT 1 UNION SELECT 1 ) ( SELECT n+1 FROM cte WHERE n < 5 UNION SELECT 1 UNION SELECT 1 )
SELECT * FROM cte; 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;
...@@ -1301,6 +1301,9 @@ bool With_element::instantiate_tmp_tables() ...@@ -1301,6 +1301,9 @@ bool With_element::instantiate_tmp_tables()
&rec_result->tmp_table_param.recinfo, &rec_result->tmp_table_param.recinfo,
0)) 0))
return true; return true;
rec_table->file->extra(HA_EXTRA_WRITE_CACHE);
rec_table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
} }
return false; return false;
} }
......
...@@ -237,12 +237,6 @@ select_union_recursive::create_result_table(THD *thd_arg, ...@@ -237,12 +237,6 @@ select_union_recursive::create_result_table(THD *thd_arg,
for (uint i=0; i < table->s->fields; i++) for (uint i=0; i < table->s->fields; i++)
rec_table->field[i]->flags &= ~PART_KEY_FLAG; 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)) if (rec_tables.push_back(rec_table))
return true; return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment