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

Out-of-range error for CREATE..SELECT unsigned_int_column+1

    XMLWordPrintable

Details

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

    Description

      SET sql_mode=STRICT_ALL_TABLES;
      CREATE OR REPLACE  TABLE t1 (a INT UNSIGNED NOT NULL);
      INSERT INTO t1 VALUES (0xFFFFFFFF);
      CREATE OR REPLACE TABLE t2 AS SELECT a+1 FROM t1;
      

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

      Adding LIMIT 0 shows that an INT(11) instead of a BITINT(11) column is created:

      CREATE OR REPLACE TABLE t2 AS SELECT a+1 FROM t1 LIMIT 0;
      DESCRIBE t2;
      

      +-------+------------------+------+-----+---------+-------+
      | Field | Type             | Null | Key | Default | Extra |
      +-------+------------------+------+-----+---------+-------+
      | a+1   | int(11) unsigned | NO   |     | 0       |       |
      +-------+------------------+------+-----+---------+-------+
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              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.