| Bug #8204 | incorrect conversion results of arithmetic operation to ucs2 string | ||
|---|---|---|---|
| Submitted: | 30 Jan 2005 20:49 | Modified: | 20 Sep 2006 16:59 |
| Reporter: | Oleksandr Byelkin | ||
| Status: | Verified | ||
| Category: | Server: Charsets | Severity: | S2 (Serious) |
| Version: | 5.0 | OS: | Any |
| Assigned to: | Alexander Barkov | Target Version: | |
| Triage: | Triaged: D3 (Medium) | ||
[30 Jan 2005 21:43]
Oleksandr Byelkin
it is script for mysql.test
Attachment: test.test (text/plain), 205 bytes.
[30 Jan 2005 21:47]
Alexander Keremidarski
Simpler test case: select convert(1.1 using ucs2); -> 1
[18 Feb 2005 17:51]
Antony Curtis
Problem is actually quite serious and seems to affect all instances where a numerical
value result is converted to a ucs2 string:
+ CREATE TABLE t1 (a varchar(64) character set ucs2);
+ INSERT INTO t1 VALUES ("1.1"), ("2.1");
+ SELECT a,hex(a) FROM t1;
+ a hex(a)
+ 1.1 0031002E0031
+ 2.1 0032002E0031
+ UPDATE t1 SET a= a + 0.1;
+ SELECT a,hex(a) FROM t1;
+ a hex(a)
+ 1? 00312E32
+ 2? 00322E32
+ UPDATE t1 SET a= a + 10;
+ SELECT a,hex(a) FROM t1;
+ a hex(a)
+ ? 3131
+ ? 3132
+ DROP TABLE t1;
+ SELECT CONVERT(1.1 USING ucs2);
+ CONVERT(1.1 USING ucs2)
+ 1?
[8 Mar 2005 12:49]
Sergei Golubchik
INSERT t1 VALUES (1.2); doesn't work very good either
[9 Mar 2005 21:05]
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/internals/22859
[27 Apr 2005 10:09]
Antony Curtis
This bug won't be fixed in 4.1 and should be documented. The patch attached to this worklog is only a poor workaround and does not solve the problem in all cases. A real solution should be developed for 5.x.
[10 May 2005 15:01]
Alexander Barkov
We had discussion with Monty, PeterG and Serg yesterday about number-to-string conversion. Decision was made to fix it in 5.1. This problem won't be fixed before 5.1. One needs to use explicit CAST to CHAR with CHARACTER SET ucs2 to make it work before 5.1.
[29 May 2006 15:00]
Miguel Solorzano
See also bug: http://bugs.mysql.com/bug.php?id=20108
[19 Jun 2007 11:01]
Alexander Barkov
See also http://bugs.mysql.com/bug.php?id=29072
[15 Oct 2007 10:38]
Alexander Barkov
See also: http://bugs.mysql.com/bug.php?id=31006

Description: incorrect conversion results of arithmetic operation to ucs2 string How to repeat: + CREATE TABLE t1 (a varchar(64) character set ucs2); + INSERT INTO t1 VALUES ("1.1"), ("2.1"); + SELECT * FROM t1; + a + 1.1 + 2.1 + update t1 set a= a + 0.1; + SELECT * FROM t1; + a + 1? + 2? + DROP TABLE t1;