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

DESC attribute does not work with auto-increment on secondary column of multi-part index

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • N/A
    • 10.8.1
    • Server
    • None

    Description

      CREATE TABLE t (a INT AUTO_INCREMENT, b INT, UNIQUE(b,a DESC)) ENGINE=MyISAM;
      INSERT IGNORE INTO t (b) VALUES (10),(10),(10);
       
      SELECT * FROM t;
       
      # Cleanup
      DROP TABLE t;
      

      preview-10.8-MDEV-13756-desc-indexes 43444ff5

      INSERT IGNORE INTO t (b) VALUES (10),(10),(10);
      Warnings:
      Warning	1062	Duplicate entry '10-2' for key 'b'
      SELECT * FROM t;
      a	b
      2	10
      1	10
      

      Without the DESC attribute, the value of `a` would continue to be auto-incremented, no warnings/errors would occur upon INSERT, and there would be 3 values in the table at the end:

      Expected result (apart from sorting in SELECT)

      INSERT IGNORE INTO t (b) VALUES (10),(10),(10);
      SELECT * FROM t;
      a	b
      1	10
      2	10
      3	10
      

      Also reproducible with Aria.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.