[MDEV-8300] CAST('' AS DECIMAL) is too strict on INSERT in strict mode Created: 2015-06-11  Updated: 2023-11-13

Status: Stalled
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.5

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 1
Labels: upstream

Issue Links:
Blocks
blocks MDEV-8109 unexpected CAST result Closed
Relates
relates to MDEV-19362 New STRICT flags for sql_mode Open
relates to MDEV-8466 CAST works differently for DECIMAL/IN... Closed
relates to MDEV-8468 CAST and INSERT work differently for ... Closed
Sprint: 10.1.8-3

 Description   

This script:

SET sql_mode='STRICT_ALL_TABLES';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a DECIMAL);
INSERT INTO t1 VALUES(CAST('' AS DECIMAL));

returns an error:

ERROR 1292 (22007): Truncated incorrect DECIMAL value: ''

This looks wrong.

I wrote an explicit CAST, so I expect:

  • CAST to return 0 with a warning
  • INSERT to write 0 into the table normally, as I'm actually inserting the CAST result, which is 0.


 Comments   
Comment by Alexander Barkov [ 2016-09-24 ]

Hmm, the was not pushed for some reasons.
It seems it was closed in a mistake.
Reopening.

Generated at Thu Feb 08 07:26:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.