Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL)
-
None
Description
- BINARY
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a BINARY(30));
INSERT INTO t1 VALUES ('1äÖüß@µ*$');
SELECT CAST(a AS DECIMAL) FROM t1;
SHOW WARNINGS;
+---------+------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1292 | Truncated incorrect DECIMAL value: '1\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' |
+---------+------+---------------------------------------------------------------------------------------------------------------------------------------------------+
- VARBINARY
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARBINARY(30));
INSERT INTO t1 VALUES ('1äÖüß@µ*$');
SELECT CAST(a AS DECIMAL) FROM t1;
SHOW WARNINGS;
+---------+------+-----------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------+
| Warning | 1292 | Truncated incorrect DECIMAL value: '1äÖüß@µ*$' |
+---------+------+-----------------------------------------------------+
- BLOB
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a BLOB);
INSERT INTO t1 VALUES ('1äÖüß@µ*$');
SELECT CAST(a AS DECIMAL) FROM t1;
SHOW WARNINGS;
Empty set (0.00 sec)
BINARY looks the most correct.