revision-id: 2c7c6f702262284ac8e5c0c2cdb6945d62fd8efc (mariadb-10.0.35-37-g2c7c6f70226) parent(s): 24d7cbe1e0a16f75e2325c84f23531742e2a035d author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-06-11 17:32:51 +0200 message: MDEV-14572: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS Restore EXPAIN flag in SELECT_LEX before execution multi-update by flag in LEX (the same but in other way made before INSERT/DELETE/SELECT) Without it, mysql_update() didn't know that there will be EXPLAIN result set and was sending OK at the end of the update, which conflicted with the EOF sent later by EXPLAIN. --- mysql-test/r/ps.result | 18 ++++++++++++++++++ mysql-test/t/ps.test | 22 ++++++++++++++++++++++ sql/sql_parse.cc | 10 ++++++++++ 3 files changed, 50 insertions(+) diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index d3fbc595f17..7e87e546fe7 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -4341,3 +4341,21 @@ LINE2 2 LINE3 3 drop table t1; # End of 5.5 tests +# +# MDEV-14572: Assertion `! is_set()' failed in +# Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found +deallocate prepare stmt; +DROP TABLE t1, t2; +# End of 10.0 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index d60edf4f6a0..c6c339caaa0 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3859,3 +3859,25 @@ FROM ) X; drop table t1; --echo # End of 5.5 tests + + +--echo # +--echo # MDEV-14572: Assertion `! is_set()' failed in +--echo # Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS +--echo # + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); + +#EXPLAIN UPDATE t1, t2 SET a = 1; +PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; +EXECUTE stmt; +EXECUTE stmt; +deallocate prepare stmt; + +# Cleanup +DROP TABLE t1, t2; + + +--echo # End of 10.0 tests + diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 28d11ef2e5c..8e216d1ef2f 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3328,6 +3328,16 @@ case SQLCOM_PREPARE: else res= 0; + /* + We can not use mysql_explain_union() because of parameters of + mysql_select in mysql_multi_update so just set the option if needed + */ + if (thd->lex->describe) + { + select_lex->set_explain_type(FALSE); + select_lex->options|= SELECT_DESCRIBE; + } + res= mysql_multi_update_prepare(thd); #ifdef HAVE_REPLICATION