diff options
author | Sachin <sachin.setiya@mariadb.com> | 2018-09-06 13:13:52 +0530 |
---|---|---|
committer | Sachin <sachin.setiya@mariadb.com> | 2018-09-06 13:25:06 +0530 |
commit | d9751996415e2ba0e7d3bd388f223abad2df6c09 (patch) | |
tree | 424a0341580bcd80dbcf5ac42bc4ccc8ad2de79d | |
parent | ff34436a2ecc30a177cb304fd1dce928d8709f45 (diff) | |
download | mariadb-git-bb-5.5-5628.tar.gz |
Mdev-5628 Assertion `! is_set()' fails on UPDATE on a partitioned table...bb-5.5-5628
with subquery (MySQL:71630)
In mysql_update after prune_partitions(thd, table, conds) we set thd->status
to ok , without considering that thd earlier might have got a error.
-rw-r--r-- | mysql-test/r/mdev_5628.result | 6 | ||||
-rw-r--r-- | mysql-test/t/mdev_5628.test | 10 | ||||
-rw-r--r-- | sql/sql_update.cc | 4 |
3 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/mdev_5628.result b/mysql-test/r/mdev_5628.result new file mode 100644 index 00000000000..5ab751b12ed --- /dev/null +++ b/mysql-test/r/mdev_5628.result @@ -0,0 +1,6 @@ +CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 1; +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); +UPDATE t1 SET a = 7 WHERE a = (select b from t2); +ERROR 21000: Subquery returns more than 1 row +drop table t1, t2; diff --git a/mysql-test/t/mdev_5628.test b/mysql-test/t/mdev_5628.test new file mode 100644 index 00000000000..8f4a23b6e2d --- /dev/null +++ b/mysql-test/t/mdev_5628.test @@ -0,0 +1,10 @@ +--source include/have_partition.inc + +CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 1; + +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); + +drop table t1, t2; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index e42f6a4ff76..c88b0d318cb 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -401,6 +401,10 @@ int mysql_update(THD *thd, if (prune_partitions(thd, table, conds)) { free_underlaid_joins(thd, select_lex); + //If we got error in SubSelect or because of any other reason + //Don't reset it (Mdev-5628) + if (thd->is_error()) + DBUG_RETURN(0); my_ok(thd); // No matching records DBUG_RETURN(0); } |