Skip to content

Commit 711f3dd

Browse files
committed
MDEV-13417 UPDATE produces wrong values if an updated column is later used as an update source
replication tests
1 parent d943d7f commit 711f3dd

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
include/master-slave.inc
2+
[connection master]
3+
set sql_mode=simultaneous_assignment;
4+
create table t1 (a int, b int);
5+
insert into t1 values(1, 2);
6+
update t1 set a=b, b=a;
7+
select * from t1;
8+
a b
9+
2 1
10+
connection slave;
11+
select * from t1;
12+
a b
13+
2 1
14+
connection master;
15+
drop table t1;
16+
include/rpl_end.inc
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
source include/master-slave.inc;
2+
3+
#
4+
# MDEV-13417 UPDATE produces wrong values if an updated column is later used as an update source
5+
#
6+
set sql_mode=simultaneous_assignment;
7+
create table t1 (a int, b int);
8+
insert into t1 values(1, 2);
9+
update t1 set a=b, b=a;
10+
select * from t1;
11+
sync_slave_with_master;
12+
select * from t1;
13+
connection master;
14+
drop table t1;
15+
source include/rpl_end.inc;

sql/log_event.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5438,7 +5438,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
54385438
if (sql_mode_inited)
54395439
thd->variables.sql_mode=
54405440
(sql_mode_t) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
5441-
(sql_mode & ~(ulong) MODE_NO_DIR_IN_CREATE));
5441+
(sql_mode & ~(sql_mode_t) MODE_NO_DIR_IN_CREATE));
54425442
if (charset_inited)
54435443
{
54445444
rpl_sql_thread_info *sql_info= thd->system_thread_info.rpl_sql_info;

0 commit comments

Comments
 (0)