summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shulga <dmitry.shulga@mariadb.com>2021-05-05 17:56:12 +0700
committerSergei Golubchik <serg@mariadb.org>2021-06-17 19:30:24 +0200
commit5478ca779a8769c4ebdf03ba5f5d7be9fdcf7ef5 (patch)
treee2e35ea1b49cad7622d949c82301efa44a9f5f66
parentf536974b73dec47ddd87cb525f2f0d26d84f1a1d (diff)
downloadmariadb-git-5478ca779a8769c4ebdf03ba5f5d7be9fdcf7ef5.tar.gz
MDEV-25576: The statement EXPLAIN running as regular statement and as prepared statement produces different results for UPDATE with subquery
10.6 cleanup
-rw-r--r--sql/sql_base.cc15
-rw-r--r--sql/sql_base.h2
-rw-r--r--sql/sql_delete.cc2
-rw-r--r--sql/sql_lex.h13
-rw-r--r--sql/sql_update.cc2
5 files changed, 15 insertions, 19 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 1ba01671201..0d3c476c0e5 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -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)
*/
diff --git a/sql/sql_base.h b/sql/sql_base.h
index 19713a051bf..cafb5967480 100644
--- a/sql/sql_base.h
+++ b/sql/sql_base.h
@@ -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.
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index c54851c295b..34fa14d4324 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -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);
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 6df1996409c..0d8251968e8 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -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;
+ }
+
};
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 738b3e0781a..07171485da4 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -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);