[MDEV-12866] Out-of-range error with CREATE..SELECT..TO_SECONDS(NOW()) Created: 2017-05-22  Updated: 2017-05-27  Resolved: 2017-05-27

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

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

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed

 Description   

SET sql_mode=STRICT_ALL_TABLES;
CREATE OR REPLACE TABLE t1 AS SELECT TO_SECONDS(NOW());

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

The problem is in this code:

  void fix_length_and_dec()
  {
    decimals=0;
    max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
    maybe_null= 1;
  }

max_length is set to a too small value, which makes it create an INT rather than BIGINT column.



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

Pushed into bb-10.2-ext

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