Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL)
-
5.5.49
Description
This script crashes the server:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 SELECT CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 4 END AS a; |
The problem is not repeatable in MySQL-5.7.11.
It seems it's trying to create a DECIMAL(0,0) column. If I change the script slightly:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 SELECT CASE WHEN TRUE THEN COALESCE(CAST(NULL AS UNSIGNED)) ELSE 40 END AS a; |
SHOW CREATE TABLE t1; |
it does not crash, but the result is incorrect:
+-------+--------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+--------------------------------------------------------------------------------------------+
|
| t1 | CREATE TABLE `t1` (
|
`a` decimal(1,0) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+--------------------------------------------------------------------------------------------+
|
The field data type DECIMAL(1,0) is too small. It should probably be DECIMAL(2,0).
MySQL-5.7.11 creates a DECIMAL(2,0) column.
Attachments
Issue Links
- relates to
-
MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool)
- Closed