diff options
author | Igor Babaev <igor@askmonty.org> | 2017-01-28 14:52:19 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2017-01-28 15:47:11 -0800 |
commit | abfcdb8fbc4dec1ef9e6ea8fc9961344186b0209 (patch) | |
tree | ad29f96d2bbff77ef346507d387f6b31b907a6f8 /sql/sql_union.cc | |
parent | 64b5e94236e7c4246863fc70b91c346ba7b66b8b (diff) | |
download | mariadb-git-abfcdb8fbc4dec1ef9e6ea8fc9961344186b0209.tar.gz |
Fixed bug mdev-10773.
The temporary tables created for recursive table references
should be closed in close_thread_tables(), because they might
be used in the statements like ANALYZE WITH r AS (...) SELECT * from r
where r is defined through recursion.
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index b30b5528741..71d0e331101 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -283,7 +283,14 @@ void select_union_recursive::cleanup() tab->file->extra(HA_EXTRA_RESET_STATE); tab->file->ha_delete_all_rows(); } - free_tmp_table(thd, tab); + /* + The table will be closed later in close_thread_tables(), + because it might be used in the statements like + ANALYZE WITH r AS (...) SELECT * from r + where r is defined through recursion. + */ + tab->next= thd->rec_tables; + thd->rec_tables= tab; } } |