diff options
author | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2020-09-17 18:55:59 +0530 |
---|---|---|
committer | Rucha Deodhar <rucha.deodhar@mariadb.com> | 2020-09-22 17:04:08 +0530 |
commit | 12dcdec221da70bbe355ad46b71f667c43061cdf (patch) | |
tree | a8dca3390e7023ba8b4a8edd5d56fb939ca4fd47 | |
parent | 5768f57d243e3fa945d79fcdc1a3eacb1e4ebb0d (diff) | |
download | mariadb-git-bb-10.1-MDEV-5628.tar.gz |
MDEV-5628: Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK &&bb-10.1-MDEV-5628
is_bulk_op())' fails on UPDATE on a partitioned table with subquery
(MySQL:71630)
Analysis and fix: Error is not checked. So correct error state is not returned.
Fix: Check for error and return the error state.
-rw-r--r-- | mysql-test/r/partition.result | 11 | ||||
-rw-r--r-- | mysql-test/t/partition.test | 16 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 |
3 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 57fa374d4f1..662929c5b48 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -2796,5 +2796,16 @@ id 16 drop table t1; # +# MDEV-5628: Assertion `! is_set()' or `!is_set() || +# (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a +# partitioned table with subquery (MySQL:71630) +# +CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2; +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); +UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6; +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1,t2; +# # End of 10.1 tests # diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 23f3fa0b4d8..b82485dfc5c 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -2999,5 +2999,21 @@ select id from t1 where data = 'ab' order by id; drop table t1; --echo # +--echo # MDEV-5628: Assertion `! is_set()' or `!is_set() || +--echo # (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a +--echo # partitioned table with subquery (MySQL:71630) +--echo # + +CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2; + +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); + +--error ER_SUBQUERY_NO_1_ROW +UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6; + +DROP TABLE t1,t2; + +--echo # --echo # End of 10.1 tests --echo # diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 9b2d24c3ba3..f44aaa2ea99 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -413,6 +413,8 @@ int mysql_update(THD *thd, query_plan.set_no_partitions(); if (thd->lex->describe || thd->lex->analyze_stmt) goto produce_explain_and_leave; + if (thd->is_error()) + DBUG_RETURN(1); my_ok(thd); // No matching records DBUG_RETURN(0); |