diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 745a340ec94..766b0277955 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -230,6 +230,9 @@ select min(a) from t1 group by inet_ntoa(a); min(a) -2 drop table t1; +SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs; +NAME_CONST('var', 'value') COLLATE latin1_general_cs +value End of 5.0 tests select connection_id() > 0; connection_id() > 0 diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index 7a579088d23..29f4f51cd0d 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -246,6 +246,12 @@ insert into t1 values (-1), (-2); select min(a) from t1 group by inet_ntoa(a); drop table t1; +# +# BUG#34289 - Incorrect NAME_CONST substitution in stored procedures breaks +# replication +# +SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs; + --echo End of 5.0 tests # diff --git a/sql/item.cc b/sql/item.cc index ab9243fcaf5..f28ef8967af 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1269,6 +1269,7 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref) return TRUE; } 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; fixed= 1;