1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Fix of MDEV-3874: Server crashes in Item_field::print on a SELECT from a MERGE view with materialization+semijoin, subquery, ORDER BY.

The problem was that in debugging binaries it try to print item to assign human readable name to the item.
But subquery item was already freed (join_free/cleanup with full cleanup) so Item_field refers to temporary
table which memory had been already freed.
This commit is contained in:
unknown
2012-11-26 21:22:44 +02:00
parent 5e345281e3
commit b8b875cb79
4 changed files with 83 additions and 0 deletions

View File

@@ -2074,6 +2074,7 @@ JOIN::reinit()
ULL(0));
first_record= 0;
cleaned= false;
if (exec_tmp_table1)
{
@@ -10623,6 +10624,7 @@ void JOIN::cleanup(bool full)
{
tab->cleanup();
}
cleaned= true;
}
else
{
@@ -22409,6 +22411,17 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
str->append(STRING_WITH_LEN("select "));
if (join && join->cleaned)
{
/*
JOIN already cleaned up so it is dangerous to print items
because temporary tables they pointed on could be freed.
*/
str->append('#');
str->append(select_number);
return;
}
/* First add options */
if (options & SELECT_STRAIGHT_JOIN)
str->append(STRING_WITH_LEN("straight_join "));