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

AUTO_INCREMENT column throws range error on INSERT in partitioned table | Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed.

    XMLWordPrintable

Details

    Description

      An out of range error is produced when an INSERT is targeted at a partitioned table with a PARTITION clause to force the partition selection. Only occurs when using SELECT to get rows, not when using VALUES clause. Only occurs if the most recent statement targeting the table was a TRUNCATE PARTITION, but the TRUNCATE could be on any partition, not just the one being inserted.

      The auto increment has plenty of room within the INT data type size and the relevant field values match the targeted partition. Performing a SELECT without a PARTITION clause against the table resolves the situation and the INSERT with PARTITION succeeds.

      Related to MDEV-20718 and MDEV-18244

      Before the fixes from MDEV-18244 this would crash. After that was fixed, the VALUES version of the INSERT worked, but the SELECT version throws the out of range error.

      I have attached a test case that is slightly modified from the one in MDEV-20718 which demonstrates the slightly different scenario of using INSERT..SELECT.

      mariadb-bug-v2.sql

      Attachments

        Issue Links

          Activity

            People

              nayuta-yanagisawa Nayuta Yanagisawa (Inactive)
              jacob.williams Jacob Williams
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.