Skip to content

Commit

Permalink
MDEV-13417 UPDATE produces wrong values if an updated column is later…
Browse files Browse the repository at this point in the history
… used as an update source

replication tests
  • Loading branch information
vuvova committed Feb 12, 2018
1 parent d943d7f commit 711f3dd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
16 changes: 16 additions & 0 deletions mysql-test/suite/rpl/r/rpl_update.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include/master-slave.inc
[connection master]
set sql_mode=simultaneous_assignment;
create table t1 (a int, b int);
insert into t1 values(1, 2);
update t1 set a=b, b=a;
select * from t1;
a b
2 1
connection slave;
select * from t1;
a b
2 1
connection master;
drop table t1;
include/rpl_end.inc
15 changes: 15 additions & 0 deletions mysql-test/suite/rpl/t/rpl_update.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source include/master-slave.inc;

#
# MDEV-13417 UPDATE produces wrong values if an updated column is later used as an update source
#
set sql_mode=simultaneous_assignment;
create table t1 (a int, b int);
insert into t1 values(1, 2);
update t1 set a=b, b=a;
select * from t1;
sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
source include/rpl_end.inc;
2 changes: 1 addition & 1 deletion sql/log_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5438,7 +5438,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
if (sql_mode_inited)
thd->variables.sql_mode=
(sql_mode_t) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
(sql_mode & ~(ulong) MODE_NO_DIR_IN_CREATE));
(sql_mode & ~(sql_mode_t) MODE_NO_DIR_IN_CREATE));
if (charset_inited)
{
rpl_sql_thread_info *sql_info= thd->system_thread_info.rpl_sql_info;
Expand Down

0 comments on commit 711f3dd

Please sign in to comment.