1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-13354: Server crashes in find_field_in_tables upon PS with window function and subquery

When creating an Item_direct_view_ref we were setting the
Name_resolution_context based on TABLE_LIST::view member variable.
However, for derived tables this member is NULL. To not set a wrong
context, if TABLE_LIST::view is empty, use THD::lex instead.
This commit is contained in:
Vicențiu Ciorbaru
2017-09-18 18:57:17 +03:00
parent 454b9b1bdc
commit a1e589be9b
3 changed files with 25 additions and 2 deletions

View File

@ -5766,9 +5766,10 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
{
DBUG_RETURN(field);
}
Name_resolution_context *context= view->view ? &view->view->select_lex.context :
&thd->lex->select_lex.context;
Item *item= (new (thd->mem_root)
Item_direct_view_ref(thd, &view->view->select_lex.context,
field_ref, view->alias,
Item_direct_view_ref(thd, context, field_ref, view->alias,
name, view));
/*
Force creation of nullable item for the result tmp table for outer joined