[MDEV-15930] Wrong field type for CAST(decimal_column AS [UN]SIGNED) Created: 2018-04-19  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-13232 Assertion `(&(&share->intern_lock)->m... Closed
Epic Link: Data type cleanups

 Description   

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 AS SELECT
  CAST(1.1111111111 AS SIGNED) AS c1,
  CAST(1.1111111111 AS UNSIGNED) AS c2;
DESC t1;

+-------+---------------------+------+-----+---------+-------+
| Field | Type                | Null | Key | Default | Extra |
+-------+---------------------+------+-----+---------+-------+
| c1    | bigint(13)          | NO   |     | NULL    |       |
| c2    | bigint(20) unsigned | NO   |     | NULL    |       |
+-------+---------------------+------+-----+---------+-------+

Looks wrong:

  • the data type is wrong. It should be int instead of bigint
  • the length is too large. It should be around 1.

Generated at Thu Feb 08 08:25:05 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.