List:Commits« Previous MessageNext Message »
From:Leonard Zhou Date:March 19 2009 3:00am
Subject:bzr commit into mysql-5.0-bugteam branch (zhou.li:2714) Bug#35515
View as plain text  
#At file:///home/zhl/mysql/rep/5.0/bug35515/

 2714 Leonard Zhou	2009-03-19
      BUG#35515 Aliases of variables in binary log are ignored with NAME_CONST.
      
      When add an aliase name after NAME_CONST, the aliase name will be overwrite.
      
      NAME_CONST will set the field's name to aliase name if there is an aliase.
added:
  mysql-test/r/rpl_name_const.result
  mysql-test/t/rpl_name_const.test
modified:
  sql/item.cc

per-file messages:
  mysql-test/r/rpl_name_const.result
    Test result.
  mysql-test/t/rpl_name_const.test
    Test case.
  sql/item.cc
    Don't set item name if the name is autogenerated, that mean without aliase.
=== added file 'mysql-test/r/rpl_name_const.result'
--- a/mysql-test/r/rpl_name_const.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/rpl_name_const.result	2009-03-19 02:58:20 +0000
@@ -0,0 +1,33 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+==== Initialize ====
+[on master]
+drop database if exists testdb;
+create database testdb;
+create table t1 (id int);
+==== create a procedure that has a column alias in a subquery ====
+drop procedure if exists test_procedure;
+create procedure test_procedure(_id int)
+begin
+insert into t1 (id)
+select a.id
+from 
+( select _id as id ) a;
+end;$$
+==== enable the binary log, then call the procedure ====
+call test_procedure(1234);
+[on slave]
+select * from t1 order by id;
+id
+1234
+select NAME_CONST('_id',1234) as id;
+id
+1234
+==== Clean up ====
+[on master]
+drop table t1;
+drop procedure test_procedure;

=== added file 'mysql-test/t/rpl_name_const.test'
--- a/mysql-test/t/rpl_name_const.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/rpl_name_const.test	2009-03-19 02:58:20 +0000
@@ -0,0 +1,52 @@
+# ==== Purpose ====
+#
+# Test that aliases of variables in binary log aren't ignored with NAME_CONST.
+#
+# ==== Method ====
+#
+# Create a procedure with aliases of variables, then replicate it to slave.
+# BUG#35515 Aliases of variables in binary log are ignored with NAME_CONST.
+#
+
+source include/master-slave.inc;
+
+--echo ==== Initialize ====
+
+--echo [on master]
+--connection master
+
+--disable_warnings
+drop database if exists testdb;
+--enable_warnings
+create database testdb;
+create table t1 (id int);
+
+--echo ==== create a procedure that has a column alias in a subquery ====
+--disable_warnings
+drop procedure if exists test_procedure;
+--enable_warnings
+delimiter $$;
+create procedure test_procedure(_id int)
+begin
+insert into t1 (id)
+select a.id
+from 
+( select _id as id ) a;
+end;$$
+delimiter ;$$
+
+--echo ==== enable the binary log, then call the procedure ====
+call test_procedure(1234);
+
+
+--echo [on slave]
+sync_slave_with_master;
+select * from t1 order by id;
+select NAME_CONST('_id',1234) as id;
+
+--echo ==== Clean up ====
+
+--echo [on master]
+connection master;
+drop table t1;
+drop procedure test_procedure;

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-02-20 09:42:35 +0000
+++ b/sql/item.cc	2009-03-19 02:58:20 +0000
@@ -1282,7 +1282,10 @@ bool Item_name_const::fix_fields(THD *th
     my_error(ER_RESERVED_SYNTAX, MYF(0), "NAME_CONST");
     return TRUE;
   }
-  set_name(item_name->ptr(), (uint) item_name->length(), system_charset_info);
+  if (is_autogenerated_name)
+  {
+    set_name(item_name->ptr(), (uint) item_name->length(), system_charset_info);
+  }
   collation.set(value_item->collation.collation, DERIVATION_IMPLICIT);
   max_length= value_item->max_length;
   decimals= value_item->decimals;

Thread
bzr commit into mysql-5.0-bugteam branch (zhou.li:2714) Bug#35515Leonard Zhou19 Mar
  • Re: bzr commit into mysql-5.0-bugteam branch (zhou.li:2714) Bug#35515He Zhenxing19 Mar
    • Re: bzr commit into mysql-5.0-bugteam branch (zhou.li:2714) Bug#35515Leonard zhou19 Mar
      • Re: bzr commit into mysql-5.0-bugteam branch (zhou.li:2714) Bug#35515He Zhenxing19 Mar