Commit 5478ca77 authored by Dmitry Shulga's avatar Dmitry Shulga Committed by Sergei Golubchik

MDEV-25576: The statement EXPLAIN running as regular statement and as prepared...

MDEV-25576: The statement EXPLAIN running as regular statement and as prepared statement produces different results for UPDATE with subquery

10.6 cleanup
parent f536974b
......@@ -9276,21 +9276,6 @@ int dynamic_column_error_message(enum_dyncol_func_result rc)
return rc;
}
/**
Turn on the SELECT_DESCRIBE flag for the primary SELECT_LEX of the statement
being processed in case the statement is EXPLAIN UPDATE/DELETE.
@param lex current LEX
*/
void promote_select_describe_flag_if_needed(LEX *lex)
{
if (lex->describe)
lex->first_select_lex()->options|= SELECT_DESCRIBE;
}
/**
@} (end of group Data_Dictionary)
*/
......@@ -518,8 +518,6 @@ bool extend_table_list(THD *thd, TABLE_LIST *tables,
Prelocking_strategy *prelocking_strategy,
bool has_prelocking_list);
void promote_select_describe_flag_if_needed(LEX *lex);
/**
A context of open_tables() function, used to recover
from a failed open_table() or open_routine() attempt.
......
......@@ -366,7 +366,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
query_plan.select_lex= thd->lex->first_select_lex();
query_plan.table= table;
promote_select_describe_flag_if_needed(thd->lex);
thd->lex->promote_select_describe_flag_if_needed();
if (mysql_prepare_delete(thd, table_list, &conds, &delete_while_scanning))
DBUG_RETURN(TRUE);
......
......@@ -4773,6 +4773,19 @@ struct LEX: public Query_tables_list
bool resolve_references_to_cte(TABLE_LIST *tables,
TABLE_LIST **tables_last);
/**
Turn on the SELECT_DESCRIBE flag for every SELECT_LEX involved into
the statement being processed in case the statement is EXPLAIN UPDATE/DELETE.
@param lex current LEX
*/
void promote_select_describe_flag_if_needed()
{
if (describe)
builtin_select.options |= SELECT_DESCRIBE;
}
};
......
......@@ -468,7 +468,7 @@ int mysql_update(THD *thd,
want_privilege= (table_list->view ? UPDATE_ACL :
table_list->grant.want_privilege);
#endif
promote_select_describe_flag_if_needed(thd->lex);
thd->lex->promote_select_describe_flag_if_needed();
if (mysql_prepare_update(thd, table_list, &conds, order_num, order))
DBUG_RETURN(1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment