[MDEV-29428] Incorrect result for delete with "order by" clause Created: 2022-08-31  Updated: 2023-12-27  Resolved: 2023-12-27

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Delete
Affects Version/s: None
Fix Version/s: 11.1.1

Type: Bug Priority: Major
Reporter: Lena Startseva Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-28883 Re-design the upper level of handling... Closed
Relates
relates to MDEV-33121 Assertion Failed at /mariadb-11.3.0/s... Confirmed

 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



 Comments   
Comment by Julien Fritsch [ 2023-12-05 ]

Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.

Comment by JiraAutomate [ 2023-12-05 ]

Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.

Generated at Thu Feb 08 10:08:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.