MDEV-14786 Server crashes in Item_cond::transform on 2nd execution of SP querying from a view
instead of skipping invalid items in setup_conds(), don't pass them into a JOIN at all (test case in versioning.select2)
This commit is contained in:
parent
1ea2b2956b
commit
715a507e33
@ -7997,10 +7997,6 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List<TABLE_LIST> &leaves,
|
|||||||
TABLE_LIST *derived= select_lex->master_unit()->derived;
|
TABLE_LIST *derived= select_lex->master_unit()->derived;
|
||||||
DBUG_ENTER("setup_conds");
|
DBUG_ENTER("setup_conds");
|
||||||
|
|
||||||
/* Do not fix conditions for the derived tables that have been merged */
|
|
||||||
if (derived && derived->merged)
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
|
|
||||||
select_lex->is_item_list_lookup= 0;
|
select_lex->is_item_list_lookup= 0;
|
||||||
|
|
||||||
thd->mark_used_columns= MARK_COLUMNS_READ;
|
thd->mark_used_columns= MARK_COLUMNS_READ;
|
||||||
|
@ -645,6 +645,7 @@ bool st_select_lex_unit::prepare_join(THD *thd_arg, SELECT_LEX *sl,
|
|||||||
bool is_union_select)
|
bool is_union_select)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("st_select_lex_unit::prepare_join");
|
DBUG_ENTER("st_select_lex_unit::prepare_join");
|
||||||
|
TABLE_LIST *derived= sl->master_unit()->derived;
|
||||||
bool can_skip_order_by;
|
bool can_skip_order_by;
|
||||||
sl->options|= SELECT_NO_UNLOCK;
|
sl->options|= SELECT_NO_UNLOCK;
|
||||||
JOIN *join= new JOIN(thd_arg, sl->item_list,
|
JOIN *join= new JOIN(thd_arg, sl->item_list,
|
||||||
@ -660,7 +661,7 @@ bool st_select_lex_unit::prepare_join(THD *thd_arg, SELECT_LEX *sl,
|
|||||||
|
|
||||||
saved_error= join->prepare(sl->table_list.first,
|
saved_error= join->prepare(sl->table_list.first,
|
||||||
sl->with_wild,
|
sl->with_wild,
|
||||||
sl->where,
|
(derived && derived->merged ? NULL : sl->where),
|
||||||
(can_skip_order_by ? 0 :
|
(can_skip_order_by ? 0 :
|
||||||
sl->order_list.elements) +
|
sl->order_list.elements) +
|
||||||
sl->group_list.elements,
|
sl->group_list.elements,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user