summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/sp.result14
-rw-r--r--mysql-test/t/sp.test23
-rw-r--r--sql/item_func.cc2
3 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index a4c920f8e15..0f874cd1ceb 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -4768,4 +4768,18 @@ Handler
Inner
drop procedure bug15011|
drop table t3|
+drop function if exists bug17615|
+create table t3 (a varchar(256) unicode)|
+create function bug17615() returns varchar(256) unicode
+begin
+declare tmp_res varchar(256) unicode;
+set tmp_res= 'foo string';
+return tmp_res;
+end|
+insert into t3 values(bug17615())|
+select * from t3|
+a
+foo string
+drop function bug17615|
+drop table t3|
drop table t1,t2;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 243c1b413b7..fd79286dd0f 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -5616,6 +5616,29 @@ drop table t3|
#
+# BUG#17615: problem with character set
+#
+--disable_warnings
+drop function if exists bug17615|
+--enable_warnings
+
+create table t3 (a varchar(256) unicode)|
+
+create function bug17615() returns varchar(256) unicode
+begin
+ declare tmp_res varchar(256) unicode;
+ set tmp_res= 'foo string';
+ return tmp_res;
+end|
+
+insert into t3 values(bug17615())|
+select * from t3|
+
+drop function bug17615|
+drop table t3|
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
diff --git a/sql/item_func.cc b/sql/item_func.cc
index a85f05c2e22..ccfb71e9d0c 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4881,6 +4881,7 @@ Item_func_sp::fix_length_and_dec()
{
decimals= result_field->decimals();
max_length= result_field->field_length;
+ collation.set(result_field->charset());
DBUG_VOID_RETURN;
}
@@ -4891,6 +4892,7 @@ Item_func_sp::fix_length_and_dec()
}
decimals= field->decimals();
max_length= field->field_length;
+ collation.set(field->charset());
maybe_null= 1;
delete field;
DBUG_VOID_RETURN;