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

Wrong autoinc value assigned by LOAD XML in the NO_AUTO_VALUE_ON_ZERO mode

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
    • 10.3.3
    • Data types
    • None

    Description

      This is a similar problem to one that was earlier fixed in MySQL-5.0 under terms of:
      Bug#27586 Wrong autoinc value assigned by LOAD DATA in the NO_AUTO_VALUE_ON_ZERO mode

      Now for LOAD XML instead of LOAD DATA.

      I put a file MYSQL_HOME_DIR/test/t1.xml with this content:

      <list>
        <row a="1" b="bbb1"/>
        <row b="bbb2"/>
      </list>
      

      and run this script:

      SET @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
      CREATE OR REPLACE TABLE t1(a INT AUTO_INCREMENT PRIMARY KEY, b TEXT);
      LOAD XML INFILE 't1.xml' INTO TABLE t1 ROWS IDENTIFIED BY '<row>';
      SELECT * FROM t1 ORDER BY b;
      

      It returns the following data:

      +---+------+
      | a | b    |
      +---+------+
      | 1 | bbb1 |
      | 0 | bbb2 |
      +---+------+
      

      The auto-increment value for the second record is wrong. It should be 2 rather than 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.