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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1, 10.2, 10.3
    • 10.3.1
    • OTHER

    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

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.