[MDEV-12859] Out-of-range error for CREATE..SELECT @a:=EXTRACT(MINUTE_MICROSECOND FROM..) Created: 2017-05-21  Updated: 2017-05-22  Resolved: 2017-05-22

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.1, 10.2, 10.3
Fix Version/s: 10.3.1

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: datatype

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
Relates
relates to MDEV-12858 Out-of-range error for CREATE..SELECT... Closed
relates to MDEV-12860 Out-of-range error on CREATE..SELECT ... Closed

 Description   

SET sql_mode=STRICT_ALL_TABLES;
CREATE OR REPLACE TABLE t1 AS SELECT @a:=EXTRACT(MINUTE_MICROSECOND FROM '2001-01-01 11:22:33.999999') AS c1;

ERROR 1264 (22003): Out of range value for column 'c1' at row 1

Note, the special thing about EXTRACT(MINUTE_MICROSECOND) is that its max_length is set to 10, which makes its data type ambiguous between INT and BIGINT. All other EXTRACT types determine the data type from length unambiguously.

The correct data type is BIGINT, but Item_func::create_tmp_field() does not handle it properly and creates an INT column instead.



 Comments   
Comment by Alexander Barkov [ 2017-05-22 ]

Pushed into bb-10.2-ext

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