1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix LP BUG#685411

Analysis:
The assert failed because st_select_lex::print() was called for subqueries
as follows:

Item_subselect::print() ->
  subselect_single_select_engine::print() -> st_select_lex::print()

It was Item_subselect::fix_fields() that set the thd by calling set_thd(),
so when this print() was called before fix_fields(), subselect_engine::thd
was NULL.

Solution:
The patch makes all constructors of all subselect_engine classes to take
a THD parameter. The default subselect_single_select_engine engine is created
early during parse time, in the Item_subselect::init call, so we pass the
correct THD object already at this point.
This commit is contained in:
unknown
2010-12-14 14:08:05 +02:00
parent 419d524ff9
commit 4f28dcbe32
3 changed files with 34 additions and 36 deletions

View File

@ -19518,10 +19518,7 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str,
void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
{
/* TODO: thd may not be set for sub queries, but this should be fixed */
DBUG_ASSERT(thd);
if (!thd)
thd= current_thd;
str->append(STRING_WITH_LEN("select "));