[MDEV-31664] Unexpected and/or excessive warnings upon cast in default Created: 2023-07-11  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1

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

Issue Links:
Relates
relates to MDEV-31665 Mixed up errors and warnings in the r... Open

 Description   

CREATE TABLE t (a INT, b CHAR(8), KEY(b));
INSERT INTO t VALUES (1,'x');
ALTER TABLE t MODIFY a DECIMAL(65,10) DEFAULT(-CAST(POW(10,20) AS UNSIGNED));
SELECT * FROM t;
 
DROP TABLE t;

10.4 9856bb42

CREATE TABLE t (a INT, b CHAR(8), KEY(b));
INSERT INTO t VALUES (1,'x');
ALTER TABLE t MODIFY a DECIMAL(65,10) DEFAULT(-CAST(POW(10,20) AS UNSIGNED));
Warnings:
Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
SELECT * FROM t;
a	b
1.0000000000	x
Warnings:
Note	1916	Got overflow when converting '1e20' to UNSIGNED BIGINT. Value truncated
DROP TABLE t;

There are several strange things here.
First, upon ALTER, should it really a Note (not an error), given that it's a strict mode.
Second, why are there five of them upon ALTER, even though there is only one row in the table, and even that row doesn't require default value upon ALTER.
Third and may be the strangest, why is there a warning upon SELECT, select doesn't use DEFAULT.


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