List:Commits« Previous MessageNext Message »
From:Leonard Zhou Date:March 17 2009 11:23am
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-17
      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 ignored.
      
      Our solution is that set the column to aliase name if the column name is not autogenerated.
      That means if we have an aliase name after NAME_CONST, we will set aliase name.
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-17 11:21:29 +0000
@@ -0,0 +1,32 @@
+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;
+use testdb;
+create table table1 (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 table1 (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]
+use testdb;
+select * from table1 order by id;
+id
+1234
+==== Clean up ====
+[on master]
+drop table table1;
+drop database testdb;

=== 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-17 11:21:29 +0000
@@ -0,0 +1,54 @@
+# ==== 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;
+use testdb;
+create table table1 (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 table1 (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;
+use testdb;
+select * from table1 order by id;
+
+--echo ==== Clean up ====
+
+--echo [on master]
+connection master;
+drop table table1;
+drop database testdb;
+

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-02-20 09:42:35 +0000
+++ b/sql/item.cc	2009-03-17 11:21:29 +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 Zhou17 Mar
  • Re: bzr commit into mysql-5.0-bugteam branch (zhou.li:2714) Bug#35515He Zhenxing18 Mar
  • Re: bzr commit into mysql-5.0-bugteam branch (zhou.li:2714) Bug#35515Luís Soares18 Mar