From df1b674a695c6cba3228a94a556f97c707e732fc Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Feb 2005 16:26:04 +0100 Subject: [PATCH 1/2] BUG#6676: Derivation of user variables should be of derivation "IMPLICIT" --- mysql-test/r/rpl_charset.result | 7 +++++++ mysql-test/t/rpl_charset.test | 13 +++++++++++++ sql/log_event.cc | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result index cab41344238..292cfb19175 100644 --- a/mysql-test/r/rpl_charset.result +++ b/mysql-test/r/rpl_charset.result @@ -207,3 +207,10 @@ select hex(c1), hex(c2) from t1; hex(c1) hex(c2) CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3 drop table t1; +create table `t1` ( +`pk` varchar(10) not null default '', +primary key (`pk`) +) engine=myisam default charset=latin1; +set @p=_latin1 'test'; +update t1 set pk='test' where pk=@p; +drop table t1; diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test index 68036ae49f1..3f7eabfa434 100644 --- a/mysql-test/t/rpl_charset.test +++ b/mysql-test/t/rpl_charset.test @@ -169,3 +169,16 @@ select hex(c1), hex(c2) from t1; connection master; drop table t1; sync_slave_with_master; + +# +# BUG#6676: Derivation of variables must be correct on slave +# +connection master; +create table `t1` ( + `pk` varchar(10) not null default '', + primary key (`pk`) +) engine=myisam default charset=latin1; +set @p=_latin1 'test'; +update t1 set pk='test' where pk=@p; +drop table t1; +sync_slave_with_master; diff --git a/sql/log_event.cc b/sql/log_event.cc index 19113a3b97e..7d2848700f6 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2528,7 +2528,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli) 0 can be passed as last argument (reference on item) */ e.fix_fields(thd, 0, 0); - e.update_hash(val, val_len, type, charset, DERIVATION_NONE); + e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT); free_root(thd->mem_root,0); rli->inc_event_relay_log_pos(get_event_len()); From 25b205cec8d634220677f633c015ce8c7bde6c51 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 21 Feb 2005 17:52:15 +0100 Subject: [PATCH 2/2] BUG#6676: Added comment for the fix --- sql/log_event.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sql/log_event.cc b/sql/log_event.cc index 7d2848700f6..fabc6718826 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2528,6 +2528,11 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli) 0 can be passed as last argument (reference on item) */ e.fix_fields(thd, 0, 0); + /* + A variable can just be considered as a table with + a single record and with a single column. Thus, like + a column value, it could always have IMPLICIT derivation. + */ e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT); free_root(thd->mem_root,0);