Skip to content

Commit

Permalink
MDEV-5973: MySQL Bug#11757486:49539: NON-DESCRIPTIVE ERR (ERROR 0 FRO…
Browse files Browse the repository at this point in the history
…M STORAGE ENGINE) WITH MULTI-TABLE UPDATE

Condition in processing IGNORE clause for UPDATE & multi-table UPDATE made the same.
  • Loading branch information
sanja-byelkin committed Jun 21, 2016
1 parent 8255781 commit 911af69
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
32 changes: 32 additions & 0 deletions mysql-test/r/multi_update.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 24 additions & 0 deletions mysql-test/t/multi_update.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion sql/sql_update.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 911af69

Please sign in to comment.