From 944915cabe8712780e558bc9c41bdb12e5f1a5a7 Mon Sep 17 00:00:00 2001 From: Leonard Zhou Date: Thu, 26 Mar 2009 15:38:17 +0800 Subject: 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 re-set the field's name only if there isn't an aliase in the function fix-fields(). If there is an aliase, NAME_CONST doesn't re-set the field's name and keeps the old name. mysql-test/r/func_misc.result: Test result. mysql-test/r/rpl_name_const.result: Test case. mysql-test/t/func_misc.test: Add NAME_CONST test. mysql-test/t/rpl_name_const.test: Test result. sql/item.cc: Re-set field's name if the name is autogenerated, that mean without aliase. --- sql/item.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/item.cc b/sql/item.cc index f32828629cf..aa2138a0345 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1282,7 +1282,10 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref) 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; -- cgit v1.2.1