[MDEV-25443] MIN(timestamp) returns wrong result for near-zero times Created: 2021-04-17  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Temporal Types
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None


 Description   

For timestamps in (0,1) second interval (less than a second since the epoch) MIN returns zero.

SET time_zone='+00:00';
 
CREATE TABLE t1 (a TIMESTAMP(1));
INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'),('1970-01-01 00:00:00.9');
 
SELECT a FROM t1;
SELECT MIN(a) FROM t1;
 
# Cleanup
DROP TABLE t1;

10.4 c03841ec

SELECT a FROM t1;
a
1970-01-01 00:00:00.1
1970-01-01 00:00:00.9
SELECT MIN(a) FROM t1;
MIN(a)
0000-00-00 00:00:00.0

The problem was introduced in 10.4.1 by this commit:

commit 34eb98387f8f46a80fb053081dbe20d415f23b39 (HEAD)
Author: Alexander Barkov
Date:   Sat Dec 8 19:39:23 2018 +0400
 
    MDEV-13995 MAX(timestamp) returns a wrong result near DST change


Generated at Thu Feb 08 09:37:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.