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

Incorrect result for delete with "order by" clause

    XMLWordPrintable

    Details

      Description

      4 rows are expected to be deleted, but only one row is deleted:

      Test:

      --source include/have_innodb.inc
       
      create table t1 (c1 integer, c2 integer, c3 integer) engine=InnoDB;
       
      insert into t1(c1,c2,c3) values (1,1,1);
      insert into t1(c1,c2,c3) values (1,2,2);
      insert into t1(c1,c2,c3) values (1,3,3);
      insert into t1(c1,c2,c3) values (2,1,4);
      insert into t1(c1,c2,c3) values (2,2,5);
      insert into t1(c1,c2,c3) values (2,3,6);
      insert into t1(c1,c2,c3) values (2,4,7);
      insert into t1(c1,c2,c3) values (2,5,8);
       
      --enable_info ONCE
      delete from t1 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3 order by c2;
      select * from t1;
       
      drop table t1;
      

      Expected result:

      affected rows: 4
      select * from t1;
      c1	c2	c3
      1	1	1
      1	2	2
      2	1	4
      2	2	5
      

      Actual result:

      affected rows: 1
      select * from t1;
      c1	c2	c3
      1	1	1
      1	2	2
      1	3	3
      2	1	4
      2	2	5
      2	3	6
      2	4	7
      

      The test will be added as part of the task MDEV-29427

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              igor Igor Babaev
              Reporter:
              lstartseva Lena Startseva
              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.