Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12859

Out-of-range error for CREATE..SELECT @a:=EXTRACT(MINUTE_MICROSECOND FROM..)

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.2, 10.3
    • Fix Version/s: 10.3.1
    • Component/s: OTHER
    • Labels:

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: