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

10.6 cleanup
This commit is contained in:
Dmitry Shulga 2021-05-05 17:56:12 +07:00 committed by Sergei Golubchik
parent f536974b73
commit 5478ca779a
5 changed files with 15 additions and 19 deletions

View File

@ -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)
*/

View File

@ -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.

View File

@ -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);

View File

@ -4773,6 +4773,19 @@ public:
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;
}
};

View File

@ -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);