Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2172 06/06/28 16:41:53 anozdrin@stripped +3 -0
Fix for BUG#16211: Stored function return type for strings is ignored.
sql/sp.cc
1.113 06/06/28 16:41:49 anozdrin@stripped +12 -0
1. Added CHARSET-clause to CREATE-statement if
charset of the object's database is different
from the specified charset for return value.
2. Polishing -- provided some comments.
mysql-test/t/sp.test
1.189 06/06/28 16:41:49 anozdrin@stripped +50 -0
Provided a test case for BUG#16211.
mysql-test/r/sp.result
1.201 06/06/28 16:41:49 anozdrin@stripped +48 -0
Updated result file.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: anozdrin
# Host: booka.site
# Root: /home/alik/MySQL/devel/5.0-rt-bug16211
--- 1.200/mysql-test/r/sp.result 2006-05-18 14:44:12 +04:00
+++ 1.201/mysql-test/r/sp.result 2006-06-28 16:41:49 +04:00
@@ -4990,4 +4990,52 @@ CALL bug18037_p2()|
DROP FUNCTION bug18037_f1|
DROP PROCEDURE bug18037_p1|
DROP PROCEDURE bug18037_p2|
+DROP FUNCTION IF EXISTS bug16211_f1|
+DROP FUNCTION IF EXISTS bug16211_f2|
+DROP FUNCTION IF EXISTS bug16211_f3|
+CREATE FUNCTION bug16211_f1() RETURNS CHAR(10)
+RETURN ""|
+CREATE FUNCTION bug16211_f2() RETURNS CHAR(10) CHARSET latin1
+RETURN ""|
+CREATE FUNCTION bug16211_f3() RETURNS CHAR(10) CHARSET koi8r
+RETURN ""|
+SHOW CREATE FUNCTION bug16211_f1|
+Function sql_mode Create Function
+bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10)
+RETURN ""
+SHOW CREATE FUNCTION bug16211_f2|
+Function sql_mode Create Function
+bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10)
+RETURN ""
+SHOW CREATE FUNCTION bug16211_f3|
+Function sql_mode Create Function
+bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET koi8r
+RETURN ""
+SELECT dtd_identifier
+FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA = "test" AND ROUTINE_NAME = "bug16211_f1"|
+dtd_identifier
+char(10)
+SELECT dtd_identifier
+FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA = "test" AND ROUTINE_NAME = "bug16211_f2"|
+dtd_identifier
+char(10)
+SELECT dtd_identifier
+FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA = "test" AND ROUTINE_NAME = "bug16211_f3"|
+dtd_identifier
+char(10) CHARSET koi8r
+SELECT CHARSET(bug16211_f1())|
+CHARSET(bug16211_f1())
+latin1
+SELECT CHARSET(bug16211_f2())|
+CHARSET(bug16211_f2())
+latin1
+SELECT CHARSET(bug16211_f3())|
+CHARSET(bug16211_f3())
+koi8r
+DROP FUNCTION bug16211_f1|
+DROP FUNCTION bug16211_f2|
+DROP FUNCTION bug16211_f3|
drop table t1,t2;
--- 1.188/mysql-test/t/sp.test 2006-05-18 14:44:12 +04:00
+++ 1.189/mysql-test/t/sp.test 2006-06-28 16:41:49 +04:00
@@ -5890,6 +5890,56 @@ DROP PROCEDURE bug18037_p2|
#
+# BUG#16211: Stored function return type for strings is ignored
+#
+
+# Prepare.
+
+--disable_warnings
+DROP FUNCTION IF EXISTS bug16211_f1|
+DROP FUNCTION IF EXISTS bug16211_f2|
+DROP FUNCTION IF EXISTS bug16211_f3|
+--enable_warnings
+
+# Test case.
+
+CREATE FUNCTION bug16211_f1() RETURNS CHAR(10)
+ RETURN ""|
+
+CREATE FUNCTION bug16211_f2() RETURNS CHAR(10) CHARSET latin1
+ RETURN ""|
+
+CREATE FUNCTION bug16211_f3() RETURNS CHAR(10) CHARSET koi8r
+ RETURN ""|
+
+SHOW CREATE FUNCTION bug16211_f1|
+SHOW CREATE FUNCTION bug16211_f2|
+SHOW CREATE FUNCTION bug16211_f3|
+
+SELECT dtd_identifier
+FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA = "test" AND ROUTINE_NAME = "bug16211_f1"|
+
+SELECT dtd_identifier
+FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA = "test" AND ROUTINE_NAME = "bug16211_f2"|
+
+SELECT dtd_identifier
+FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA = "test" AND ROUTINE_NAME = "bug16211_f3"|
+
+SELECT CHARSET(bug16211_f1())|
+SELECT CHARSET(bug16211_f2())|
+SELECT CHARSET(bug16211_f3())|
+
+# Cleanup.
+
+DROP FUNCTION bug16211_f1|
+DROP FUNCTION bug16211_f2|
+DROP FUNCTION bug16211_f3|
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
--- 1.112/sql/sp.cc 2006-05-04 16:30:35 +04:00
+++ 1.113/sql/sp.cc 2006-06-28 16:41:49 +04:00
@@ -496,6 +496,13 @@ sp_returns_type(THD *thd, String &result
table.s = &table.share_not_to_be_used;
field= sp->create_result_field(0, 0, &table);
field->sql_type(result);
+
+ if (field->has_charset() && field->charset() != thd->db_charset)
+ {
+ result.append(STRING_WITH_LEN(" CHARSET "));
+ result.append(field->charset()->csname);
+ }
+
delete field;
}
@@ -976,6 +983,11 @@ sp_find_routine(THD *thd, int type, sp_n
sp_head *new_sp;
const char *returns= "";
char definer[USER_HOST_BUFF_SIZE];
+
+ /*
+ String buffer for RETURNS data type must have system charset;
+ 64 -- size of "returns" column of mysql.proc.
+ */
String retstr(64);
DBUG_PRINT("info", ("found: 0x%lx", (ulong)sp));
| Thread |
|---|
| • bk commit into 5.0 tree (anozdrin:1.2172) BUG#16211 | Alexander Nozdrin | 28 Jun |