summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2023-03-22 21:59:18 -0700
committerIgor Babaev <igor@askmonty.org>2023-03-25 12:36:59 -0700
commitf33fc2fae5c3f3e80c4d24348609f3ce5246ca9c (patch)
treec29efad6c8b20b73d5578c981ff54af96aac0b66 /sql/sql_update.cc
parent011261f4e95890b63bac83d7842ff93ced6d3ec8 (diff)
downloadmariadb-git-f33fc2fae5c3f3e80c4d24348609f3ce5246ca9c.tar.gz
MDEV-30539 EXPLAIN EXTENDED: no message with queries for DML statements
EXPLAIN EXTENDED for an UPDATE/DELETE/INSERT/REPLACE statement did not produce the warning containing the text representation of the query obtained after the optimization phase. Such warning was produced for SELECT statements, but not for DML statements. The patch fixes this defect of EXPLAIN EXTENDED for DML statements.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index a2980717018..834fa6111e5 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1371,7 +1371,8 @@ produce_explain_and_leave:
goto err;
emit_explain_and_leave:
- int err2= thd->lex->explain->send_explain(thd);
+ bool extended= thd->lex->describe & DESCRIBE_EXTENDED;
+ int err2= thd->lex->explain->send_explain(thd, extended);
delete select;
free_underlaid_joins(thd, select_lex);
@@ -1445,6 +1446,8 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
select_lex->fix_prepare_information(thd, conds, &fake_conds);
+ if (!thd->lex->upd_del_where)
+ thd->lex->upd_del_where= *conds;
DBUG_RETURN(FALSE);
}
@@ -1974,7 +1977,10 @@ bool mysql_multi_update(THD *thd, TABLE_LIST *table_list, List<Item> *fields,
else
{
if (thd->lex->describe || thd->lex->analyze_stmt)
- res= thd->lex->explain->send_explain(thd);
+ {
+ bool extended= thd->lex->describe & DESCRIBE_EXTENDED;
+ res= thd->lex->explain->send_explain(thd, extended);
+ }
}
thd->abort_on_warning= 0;
DBUG_RETURN(res);