mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
d7abca9ac3
Problem: SHOW CREATE FUNCTION and SELECT DTD_IDENTIFIER FROM I_S.ROUTINES returned wrong values in case of ENUM return data type and UCS2 character set. Fix: the string to collect returned data type was incorrectly set to "binary" character set, therefore UCS2 values where returned with extra '\0' characters. Setting string character set to creation_ctx->get_client_cs() in sp_find_routine(), and to system_charset_info in sp_create_routine fixes the problem. Adding tests: - the original test with Latin letters - an extra test with non-Latin letters
57 lines
1.2 KiB
Text
57 lines
1.2 KiB
Text
-- source include/have_ucs2.inc
|
||
|
||
delimiter |;
|
||
|
||
#
|
||
# 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|
|
||
|
||
|
||
delimiter ;|
|
||
|
||
#
|
||
# Bug#48766 SHOW CREATE FUNCTION returns extra data in return clause
|
||
#
|
||
SET NAMES utf8;
|
||
--disable_warnings
|
||
DROP FUNCTION IF EXISTS bug48766;
|
||
--enable_warnings
|
||
#
|
||
# Test that Latin letters are not prepended with extra '\0'.
|
||
#
|
||
CREATE FUNCTION bug48766 ()
|
||
RETURNS ENUM( 'w' ) CHARACTER SET ucs2
|
||
RETURN 0;
|
||
SHOW CREATE FUNCTION bug48766;
|
||
SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
|
||
WHERE ROUTINE_NAME='bug48766';
|
||
DROP FUNCTION bug48766;
|
||
#
|
||
# Test non-Latin characters
|
||
#
|
||
CREATE FUNCTION bug48766 ()
|
||
RETURNS ENUM('а','б','в','г') CHARACTER SET ucs2
|
||
RETURN 0;
|
||
SHOW CREATE FUNCTION bug48766;
|
||
SELECT DTD_IDENTIFIER FROM INFORMATION_SCHEMA.ROUTINES
|
||
WHERE ROUTINE_NAME='bug48766';
|
||
|
||
DROP FUNCTION bug48766;
|