Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL)
Description
These queries work fine:
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFF AS UNSIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFF AS UNSIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFF AS UNSIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFF AS UNSIGNED); |
There queries return an error:
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFFFF AS UNSIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFFFFFF AS UNSIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFFFFFFFF AS UNSIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED); |
ERROR 1264 (22003): Out of range value for column 'CAST(0xFFFFFFFFFF AS UNSIGNED)' at row 1
|
Adding LIMIT 0 helps to create the table and see what's the problem:
CREATE OR REPLACE TABLE t1 AS |
SELECT
|
CAST(0xFFFFFFFFFF AS UNSIGNED), |
CAST(0xFFFFFFFFFFFF AS UNSIGNED), |
CAST(0xFFFFFFFFFFFFFF AS UNSIGNED), |
CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED) LIMIT 0; |
DESCRIBE t1;
|
+--------------------------------------+-----------------+------+-----+---------+-------+
|
| Field | Type | Null | Key | Default | Extra |
|
+--------------------------------------+-----------------+------+-----+---------+-------+
|
| CAST(0xFFFFFFFFFF AS UNSIGNED) | int(5) unsigned | NO | | NULL | |
|
| CAST(0xFFFFFFFFFFFF AS UNSIGNED) | int(6) unsigned | NO | | NULL | |
|
| CAST(0xFFFFFFFFFFFFFF AS UNSIGNED) | int(7) unsigned | NO | | NULL | |
|
| CAST(0xFFFFFFFFFFFFFFFF AS UNSIGNED) | int(8) unsigned | NO | | NULL | |
|
+--------------------------------------+-----------------+------+-----+---------+-------+
|
Notice, it creates too small columns. All hex hybrids with more than 8 hexadecimal digits should create BIGINT columns.
The same problem is repeatable for SIGNED type cast:
These queries work fine:
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFF AS SIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFF AS SIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFF AS SIGNED); |
These queries return the same error:
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFF AS SIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFFFF AS SIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFFFFFF AS SIGNED); |
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFFFFFFFF AS SIGNED); |
ERROR 1264 (22003): Out of range value for column 'CAST(0xFFFFFFFFFFFFFF AS SIGNED)' at row 1
|
This query works fine again:
CREATE OR REPLACE TABLE t1 AS SELECT CAST(0xFFFFFFFFFFFFFFFF AS SIGNED); |
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed
- relates to
-
MDEV-12852 Out-of-range errors when CAST(1-2 AS UNSIGNED)
- Closed
-
MDEV-12852 Out-of-range errors when CAST(1-2 AS UNSIGNED)
- Closed
-
MDEV-12853 Out-of-range errors when CAST('-1' AS UNSIGNED)
- Closed