[MDEV-30345] DML does not find rows it is supposed to Created: 2023-01-05  Updated: 2023-02-06  Resolved: 2023-01-12

Status: Closed
Project: MariaDB Server
Component/s: Optimizer, Server, Temporal Types
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.11.2, 11.0.0, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.8, 10.9.5, 10.10.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: 11.0-sel

Issue Links:
Relates
relates to MDEV-30005 Correlated subquery with aggregate fu... Closed

 Description   

CREATE TABLE t1 (f timestamp);
INSERT INTO t1 VALUES ('2022-01-01 00:00:00'),('2022-12-12 12:12:12');
 
CREATE TABLE t2 (f timestamp);
INSERT INTO t2 VALUES ('2022-01-01 00:00:00'),('2022-12-12 12:12:12');
 
SELECT * FROM t2 WHERE f IN ( SELECT f FROM t1 ) ;
DELETE FROM t2 WHERE f IN ( SELECT f FROM t1 ) ;
SELECT * FROM t2 WHERE f IN ( SELECT f FROM t1 ) ;
 
# Cleanup
DROP TABLE t1, t2;

10.4 f97f6955

SELECT * FROM t2 WHERE f IN ( SELECT f FROM t1 ) ;
f
2022-01-01 00:00:00
2022-12-12 12:12:12
DELETE FROM t2 WHERE f IN ( SELECT f FROM t1 ) ;
SELECT * FROM t2 WHERE f IN ( SELECT f FROM t1 ) ;
f
2022-01-01 00:00:00
2022-12-12 12:12:12

Reproducible on 10.4+ with at least MyISAM and InnoDB.
Couldn't reproduce on 10.3.

The failure started happening on 10.4 after this merge in 10.4.19

commit 44d70c01f0aef419bc1325f0cba6a46085042646
Merge: 126725421e5 867724fd304
Author: Marko Mäkelä
Date:   Fri Mar 19 11:42:44 2021 +0200
 
    Merge 10.3 into 10.4

but since I cannot reproduce it on 10.3, I can't say which exact commit caused it, and don't see anything obvious in the merge.



 Comments   
Comment by Michael Widenius [ 2023-01-11 ]

The bug probably originated from a bad merge from 10.3 -> 10.4

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