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

long unique does not work like unique key when using replace

Details

    Description

      REPLACE is supposed to remove all conflicting rows.
      For UNIQUE HASH, REPLACE only removes the first conflicting row, not all conflicting rows, and generates an error:

      Test case:

      create or replace table t1 (a int primary key, b int, c int, unique key `test` (b,c) using hash) engine=myisam;
      insert into t1 values (1,1,1),(2,2,2);
      replace into t1 values (3,1,1);
      select * from t1;
      --error 1062
      replace into t1 values (3,2,2);
      select * from t1;
      

      +---+------+------+
      | a | b    | c    |
      +---+------+------+
      | 3 |    1 |    1 |
      | 2 |    2 |    2 |
      +---+------+------+
      

      Test without USING HASH

      create or replace table t1 (a int primary key, b int, c int, unique key `test` (b,c)) engine=myisam;
      insert into t1 values (1,1,1),(2,2,2);
      replace into t1 values (3,1,1);
      select * from t1;
      replace into t1 values (3,2,2);
      select * from t1;
      

      +---+------+------+
      | a | b    | c    |
      +---+------+------+
      | 3 |    2 |    2 |
      +---+------+------+
      

      Attachments

        Issue Links

          Activity

            Transition Time In Source Status Execution Times
            Alexander Barkov made transition -
            Open In Progress
            51d 18h 41m 1
            Alexander Barkov made transition -
            In Progress In Review
            41m 25s 1
            Alexander Barkov made transition -
            Stalled In Review
            5d 18h 27m 1
            Sergei Golubchik made transition -
            In Review Stalled
            7d 14h 2
            Alexander Barkov made transition -
            Stalled Closed
            1d 7h 46m 1

            People

              bar Alexander Barkov
              monty Michael Widenius
              Votes:
              1 Vote for this issue
              Watchers:
              10 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.