MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 FROM STORAGE ENGINE) WITH MULTI-TABLE UPDATE

Condition in processing IGNORE clause for UPDATE & multi-table UPDATE made the same.
This commit is contained in:
Oleksandr Byelkin 2016-06-20 14:35:58 +02:00
parent 8255781d9b
commit 911af69d1e
3 changed files with 57 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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,