Bug #18691 Converting number to UNICODE string returns invalid result.

Submitted: 31 Mar 2006 14:24 Modified: 27 Apr 2006 15:26
Reporter: Andrey Kazachkov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.21-BK, 5.0.19-pro-nt OS:Linux (Linux, Windows)
Assigned to: Alexander Barkov CPU Architecture:Any

[31 Mar 2006 14:24] Andrey Kazachkov
Description:
Converting a number to a UNICODE string returns invalid result. 

The problem looks like #17615 but patch http://lists.mysql.com/commits/3384 for #17615 doesn't help. 

The engine type is InnoDB.

How to repeat:
Following queries return invalid unicode strings

SELECT CONVERT(103  , CHAR(50) UNICODE) "CHAR UNICODE", CONVERT(103  , CHAR(50)) "CHAR";

+--------------+------+
| CHAR UNICODE | CHAR |
+--------------+------+
| 1уА│         | 103  |
+--------------+------+
1 row in set (0.00 sec)

SELECT CAST(103 AS CHAR(50) UNICODE) "CHAR UNICODE", CAST(103 AS CHAR(50)) "CHAR";

+--------------+------+
| CHAR UNICODE | CHAR |
+--------------+------+
| 1уА│         | 103  |
+--------------+------+
1 row in set (0.00 sec)

The same problem with stored procedures:

delimiter GO

DROP DATABASE IF EXISTS ak_test_db
GO

CREATE DATABASE ak_test_db  DEFAULT CHARACTER SET `ascii` COLLATE
`ascii_general_ci`
GO

USE ak_test_db
GO

CREATE PROCEDURE fault_proc(x int)
BEGIN
	SELECT CONVERT(x  , CHAR(50) UNICODE) "CHAR UNICODE", CONVERT(103  , CHAR(50)) "CHAR"; 
	SELECT CAST(x AS CHAR(50) UNICODE) "CHAR UNICODE", CAST(103 AS CHAR(50)) "CHAR"; 
END
GO

CALL fault_proc(103)
GO
[2 Apr 2006 9:39] Valeriy Kravchuk
Thank you for a bug report. Verified just as described, also with 5.0.21-BK (ChangeSet@1.2131, 2006-04-01 05:53:37+02:00) on Linux.
[13 Apr 2006 6:02] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4897
[13 Apr 2006 13:10] Sergei Glukhov
ok to push
[18 Apr 2006 7:20] Alexander Barkov
Pushed into 4.1.19.
Merged into 5.0.21.

Waiting to merge into 5.1.x.
[25 Apr 2006 10:40] Alexander Barkov
Pushed into 5.1.10
[27 Apr 2006 15:26] Paul DuBois
Noted in 4.1.19, 5.0.21, 5.1.10 changelogs.

Conversion of a number to a <literal>CHAR UNICODE</literal>
string returned an invalid result. (Bug #18691)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.043 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.