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

Wrong duplicate key value printed in ER_DUP_ENTRY

    XMLWordPrintable

Details

    Description

      I am keeping it as Major, despite it being "just" a wrong error message, because it can be important for problem diagnostics on users' side. From time to time we receive complaints of the kind "I got the error 'Duplicate key xx', but there is no duplicate xx in my table" (in various circumstances). It is difficult to investigate such problems as the real data can be dynamic, so we often consider it a user error. But it turns out the error message can be simply wrong.

      --source include/have_sequence.inc
       
      CREATE TABLE t1 (a INT) ENGINE=MyISAM;
       
      INSERT INTO t1 VALUES (8);
      INSERT INTO t1 SELECT seq FROM seq_1_to_100;
       
      --error ER_DUP_ENTRY 
      ALTER TABLE t1 ADD UNIQUE (a);
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 3e617b8b

      MariaDB [test]> ALTER TABLE t1 ADD UNIQUE (a);
      ERROR 1062 (23000): Duplicate entry '100' for key 'a'
      

      The error ER_DUP_ENTRY itself isn't wrong, there is a duplicate entry in there; but it's not 100, it is 8.

      Also reproducible with Aria.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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