From 031b6b5fbbde116e6a37b0658a9f090d2e7265ae Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 2 Oct 2003 10:31:37 +0200 Subject: fix for BUG#1331: "Unexistent user variable is not replicated". When an update query is to be written to the binlog, and it reads unset user variables (example: INSERT INTO t VALUEs(@a) where @a does not exist), we create the variable like if it had been set with SET before, and we loop (i.e. we redo the steps of logging, now that the variable exists). mysql-test/r/rpl_user_variables.result: result update. mysql-test/t/rpl_user_variables.test: test to see if unset user variables are written to the binlog sql/item_func.cc: When an update query is to be written to the binlog, and it reads unset user variables (example: INSERT INTO t VALUEs(@a) where @a does not exist), we create the variable like if it had been set with SET before, and we loop (i.e. we redo the steps of logging, now that the variable exists). --- mysql-test/t/rpl_user_variables.test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mysql-test/t/rpl_user_variables.test') diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test index 7eeccaf64f2..35fbec72ac8 100644 --- a/mysql-test/t/rpl_user_variables.test +++ b/mysql-test/t/rpl_user_variables.test @@ -29,13 +29,16 @@ insert into t1 values (@i1), (@i2), (@i3), (@i4); insert into t1 values (@r1), (@r2); insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5); insert into t1 values (@n1); -insert into t1 values (@n2); +insert into t1 values (@n2); # not explicitely set before insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1); insert into t1 values (@a+(@b:=@a+1)); set @q:='abc'; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')); set @a:=5; insert into t1 values (@a),(@a); +connection master1; # see if variable is reset in binlog when thread changes +insert into t1 values (@a),(@a),(@a*5); +select * from t1; save_master_pos; connection slave; sync_with_master; -- cgit v1.2.1