summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsvoj@mysql.com/june.mysql.com <>2008-02-19 18:16:17 +0400
committersvoj@mysql.com/june.mysql.com <>2008-02-19 18:16:17 +0400
commit921e1cc4bb217b74f29e3e0b28df253df34c8d83 (patch)
tree5da3619ac6e455f0f7ea21af3e87a903cfafa055
parentb620694ba360a6a2f051adafaf6f25e45bf2fa1b (diff)
downloadmariadb-git-921e1cc4bb217b74f29e3e0b28df253df34c8d83.tar.gz
BUG#34289 - Incorrect NAME_CONST substitution in stored procedures
breaks replication NAME_CONST() didn't replicate constant character set and collation correctly. With this fix NAME_CONST() inherits collation from the value argument.
-rw-r--r--mysql-test/r/func_misc.result3
-rw-r--r--mysql-test/t/func_misc.test6
-rw-r--r--sql/item.cc1
3 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 4f6b6d3a0d8..fa9ca3539d6 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -225,4 +225,7 @@ 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
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index ccb59df5677..17a0dbe50a7 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -237,5 +237,11 @@ 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 ffb18054750..d0dc8201577 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1240,6 +1240,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;