Skip to content

Commit 9fca664

Browse files
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) Analysis and fix: Error is not checked. So correct error state is not returned. Fix: Check for error and return the error state.
1 parent d36cd5f commit 9fca664

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

mysql-test/r/partition.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,5 +2796,16 @@ id
27962796
16
27972797
drop table t1;
27982798
#
2799+
# MDEV-5628: Assertion `! is_set()' or `!is_set() ||
2800+
# (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a
2801+
# partitioned table with subquery (MySQL:71630)
2802+
#
2803+
CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
2804+
CREATE TABLE t2 (b INT);
2805+
INSERT INTO t2 VALUES (1),(2);
2806+
UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
2807+
ERROR 21000: Subquery returns more than 1 row
2808+
DROP TABLE t1,t2;
2809+
#
27992810
# End of 10.1 tests
28002811
#

mysql-test/t/partition.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,6 +2998,22 @@ insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, '
29982998
select id from t1 where data = 'ab' order by id;
29992999
drop table t1;
30003000

3001+
--echo #
3002+
--echo # MDEV-5628: Assertion `! is_set()' or `!is_set() ||
3003+
--echo # (m_status == DA_OK_BULK && is_bulk_op())' fails on UPDATE on a
3004+
--echo # partitioned table with subquery (MySQL:71630)
3005+
--echo #
3006+
3007+
CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
3008+
3009+
CREATE TABLE t2 (b INT);
3010+
INSERT INTO t2 VALUES (1),(2);
3011+
3012+
--error ER_SUBQUERY_NO_1_ROW
3013+
UPDATE t1 SET a = 7 WHERE a = ( SELECT b FROM t2 ) ORDER BY a LIMIT 6;
3014+
3015+
DROP TABLE t1,t2;
3016+
30013017
--echo #
30023018
--echo # End of 10.1 tests
30033019
--echo #

sql/sql_update.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ int mysql_update(THD *thd,
413413
query_plan.set_no_partitions();
414414
if (thd->lex->describe || thd->lex->analyze_stmt)
415415
goto produce_explain_and_leave;
416+
if (thd->is_error())
417+
DBUG_RETURN(1);
416418

417419
my_ok(thd); // No matching records
418420
DBUG_RETURN(0);

0 commit comments

Comments
 (0)