summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/multi_update.result32
-rw-r--r--mysql-test/t/multi_update.test24
-rw-r--r--sql/sql_update.cc2
3 files changed, 57 insertions, 1 deletions
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 688184f2f83..3b75cef2cf0 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -1039,4 +1039,36 @@ f1 f2
1 97
DROP TABLE t1, t2;
DROP VIEW v1;
+#
+# MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0
+# FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE
+#
+CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB;
+INSERT INTO table_11757486 VALUES (0),(0);
+SET SESSION SQL_MODE='STRICT_ALL_TABLES';
+UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+UPDATE IGNORE table_11757486 SET field1=128;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
+UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+ERROR 22003: Out of range value for column 'field1' at row 1
+UPDATE table_11757486 SET field1=128;
+ERROR 22003: Out of range value for column 'field1' at row 1
+SET SESSION SQL_MODE='';
+UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+UPDATE IGNORE table_11757486 SET field1=128;
+Warnings:
+Warning 1264 Out of range value for column 'field1' at row 1
+Warning 1264 Out of range value for column 'field1' at row 2
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. UPDATE IGNORE is unsafe because the order in which rows are updated determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
+DROP TABLE table_11757486;
+SET SESSION SQL_MODE=default;
end of 10.0 tests
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index c013938416e..04611fef7dc 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -1082,4 +1082,28 @@ SELECT * FROM v1;
DROP TABLE t1, t2;
DROP VIEW v1;
+--echo #
+--echo # MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0
+--echo # FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE
+--echo #
+
+CREATE TABLE table_11757486 (field1 tinyint) ENGINE=INNODB;
+INSERT INTO table_11757486 VALUES (0),(0);
+SET SESSION SQL_MODE='STRICT_ALL_TABLES';
+UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+UPDATE IGNORE table_11757486 SET field1=128;
+
+--error ER_WARN_DATA_OUT_OF_RANGE
+UPDATE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+--error ER_WARN_DATA_OUT_OF_RANGE
+UPDATE table_11757486 SET field1=128;
+
+SET SESSION SQL_MODE='';
+UPDATE IGNORE (SELECT 128 as col1) x, table_11757486 SET field1=x.col1;
+UPDATE IGNORE table_11757486 SET field1=128;
+
+DROP TABLE table_11757486;
+
+SET SESSION SQL_MODE=default;
+
--echo end of 10.0 tests
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 2507c3fec53..b2af075e2f4 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1584,7 +1584,7 @@ bool mysql_multi_update(THD *thd,
DBUG_RETURN(TRUE);
}
- thd->abort_on_warning= thd->is_strict_mode();
+ thd->abort_on_warning= !ignore && thd->is_strict_mode();
List<Item> total_list;
res= mysql_select(thd, &select_lex->ref_pointer_array,