summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2020-09-17 19:03:02 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2020-09-22 17:12:57 +0530
commit1060cc4235a5f5b9e5f5fc040e3373819f115b04 (patch)
tree2dfc9cb7f70a4c92b46e1eee7fd7ccd3629bf80a
parent80075ba011fb1b90aaf349a17a6f94145c5c8864 (diff)
downloadmariadb-git-bb-10.2-MDEV-23500.tar.gz
MDEV-23500: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())'bb-10.2-MDEV-23500
failed in Diagnostics_area::set_ok_status upon multi-table update Analysis: When NULL field is copied to NOT-NULL so there is error but this error is not reported so we get the failure. Fix: Return the error state.
-rw-r--r--mysql-test/r/update.result10
-rw-r--r--mysql-test/t/update.test14
-rw-r--r--sql/sql_update.cc2
3 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 9e19abc4e9c..c1d37fc36e7 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -731,4 +731,14 @@ INSERT INTO t2 VALUES
UPDATE t1,t2 SET t1.i1 = -39 WHERE t2.d1 <> t1.i1 AND t2.d1 = t1.d2;
ERROR 22007: Incorrect datetime value: '19' for column `test`.`t1`.`i1` at row 1
DROP TABLE t1,t2;
+#
+# MDEV-23500: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+# is_bulk_op())' failed in Diagnostics_area::set_ok_status upon
+# multi-table update
+#
+CREATE TABLE t (f INT NOT NULL);
+INSERT INTO t VALUES (0),(0);
+UPDATE t AS t1 LEFT JOIN t AS t2 ON t1.f <=> t2.f SET t2.f = NULL;
+ERROR 01000: Data truncated for column 'f' at row 4
+DROP TABLE t;
# End of MariaDB 10.2 tests
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 84709102f96..3a56e7b4ef0 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -672,4 +672,18 @@ UPDATE t1,t2 SET t1.i1 = -39 WHERE t2.d1 <> t1.i1 AND t2.d1 = t1.d2;
DROP TABLE t1,t2;
+--echo #
+--echo # MDEV-23500: Assertion `!is_set() || (m_status == DA_OK_BULK &&
+--echo # is_bulk_op())' failed in Diagnostics_area::set_ok_status upon
+--echo # multi-table update
+--echo #
+
+CREATE TABLE t (f INT NOT NULL);
+INSERT INTO t VALUES (0),(0);
+
+--error WARN_DATA_TRUNCATED
+UPDATE t AS t1 LEFT JOIN t AS t2 ON t1.f <=> t2.f SET t2.f = NULL;
+
+DROP TABLE t;
+
--echo # End of MariaDB 10.2 tests
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 2e9752eeabd..660067da8d6 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -2466,6 +2466,8 @@ int multi_update::do_updates()
copy_field_ptr++)
{
(*copy_field_ptr->do_copy)(copy_field_ptr);
+ if (thd->is_error())
+ goto err2;
copy_field_ptr->to_field->set_has_explicit_value();
}