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

On duplicate key update issue with multiple unique keys and charsets

    XMLWordPrintable

Details

    Description

      I'm aware it's an edge case, but I'm not sure the difference is intentional.
      The example doesn't use on duplicate key update, but the original use case does.
      It'd be nice if on duplicate key always checked primary first.
      It'd be even nicer if there was a way to avoid abusing inserts for multi-row per-row updates.

      drop table test;
      drop table test2;
       
      create table test (
        id int(11) not null,
        a int(11) not null,
        b varchar(255) not null default '',
        primary key (id),
        unique key b (b)
      ) default charset=utf8mb3;
       
      create table test2 (
        id int(11) not null,
        a int(11) not null,
        b varchar(255) not null default '',
        primary key (id),
        unique key b (b)
      ) default charset=utf8mb4;
       
      insert into test (a, id) values (1,1);
      insert into test (a, id) values (1,1);
       
      # ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
       
      insert into test2 (a, id) values (1,1);
      insert into test2 (a, id) values (1,1);
       
      # ERROR 1062 (23000): Duplicate entry '' for key 'b'
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            XTF Olaf van der Spek
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.