Skip to content
Permalink
Browse files
MDEV-30345 DML does not find rows it is supposed to
This only happens with 'timestamp_column IN (select ...)

The reason was a missing assignment in Item_cache_timestamp::cache_value()
  • Loading branch information
montywi committed Jan 11, 2023
1 parent fdcfc25 commit f3d8a54
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
@@ -20,3 +20,21 @@ select (select max(m2.ut) from t1 m2 where m1.id <> 0) from t1 m1;
2001-01-01 00:00:00.200000
2001-01-01 00:00:00.200000
drop table t1;
#
# MDEV-30345 DML does not find rows it is supposed to
#
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 ) ;
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
DROP TABLE t1,t2;
#
# End of 10.4 tests
#
@@ -20,3 +20,21 @@ select * from t1;
select (select max(m2.ut) from t1 m2 where m1.id <> 0) from t1 m1;
drop table t1;

--echo #
--echo # MDEV-30345 DML does not find rows it is supposed to
--echo #

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 ) ;
DROP TABLE t1,t2;

--echo #
--echo # End of 10.4 tests
--echo #
@@ -10225,8 +10225,8 @@ bool Item_cache_timestamp::cache_value()
if (!example)
return false;
value_cached= true;
null_value= example->val_native_with_conversion_result(current_thd, &m_native,
type_handler());
null_value_inside= null_value=
example->val_native_with_conversion_result(current_thd, &m_native, type_handler());
return true;
}

0 comments on commit f3d8a54

Please sign in to comment.