summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2017-12-22 14:00:10 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2017-12-22 14:00:10 +0100
commit980a5c318803d6aa7355e019869597976dcf19bf (patch)
treef19ff667283da2220bfa67e583768768cb3f7e50
parent042f763268c0f209e7c12e0a6a72bb5d204dfe29 (diff)
downloadmariadb-git-10.0-bb-MDEV-14572.tar.gz
MDEV-14572: Assertion `! is_set()' failed in Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS10.0-bb-MDEV-14572
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)
-rw-r--r--mysql-test/r/ps.result17
-rw-r--r--mysql-test/t/ps.test16
-rw-r--r--sql/sql_parse.cc10
3 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 8394eab0e40..005aa5555a4 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -4322,4 +4322,21 @@ set join_cache_level=@join_cache_level_save;
deallocate prepare stmt;
drop view v1,v2,v3;
drop table t1,t2,t3;
+#
+# 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 5.5 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 675d0b5e58d..d9f5e68acc6 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3843,4 +3843,20 @@ deallocate prepare stmt;
drop view v1,v2,v3;
drop table t1,t2,t3;
+--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 5.5 tests
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index fa95c852f53..f4dd6df2c65 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3327,6 +3327,16 @@ end_with_restore_list:
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