pingcap / pingcap/tidb

When the maximum value of the `time` type is exceeded, the returned result is confusing

Open
#56,865 3 comments 0 reactions 0 assignees View on GitHub
fuzz/comp severity/minor sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```
create table lrr_test(`COL1` time DEFAULT NULL);
insert into lrr_test values('838:59:59');
select col1,adddate(col1, interval 10 hour_minute) from lrr_test where adddate(col1, interval 10 hour_minute) is null;
```

### 2. What did you expect to see? (Required)
Mysql:
+-----------+----------------------------------------+
| col1 | adddate(col1, interval 10 hour_minute) |
+-----------+----------------------------------------+
| 838:59:59 | NULL |
+-----------+----------------------------------------+

### 3. What did you see instead (Required)
Since adddate(col1, interval 10 hour_minute) returns `839:09:59`, why can it be returned in the` isnull` judgment?

> mysql> select col1,adddate(col1, interval 10 hour_minute) from lrr_test where adddate(col1, interval 10 hour_minute) is null;
> +-----------+----------------------------------------+
> | col1 | adddate(col1, interval 10 hour_minute) |
> +-----------+----------------------------------------+
> | 838:59:59 | 839:09:59 |
> +-----------+----------------------------------------+
> 1 row in set, 1 warning (0.66 sec)
>
> mysql> show warnings;
> +---------+------+-------------------------------------------------------------------------------+
> | Level | Code | Message |
> +---------+------+-------------------------------------------------------------------------------+
> | Warning | 1690 | evaluation failed: Duration value is out of range in '(838:59:59 - 00:10:00)' |
> +---------+------+-------------------------------------------------------------------------------+
> 1 row in set (0.03 sec)

### 4. What is your TiDB version? (Required)

Release Version: v8.4.0
Edition: Community
Git Commit Hash: 2511e928966110964414e6bbb630a565a9870a52
Git Branch: HEAD
UTC Build Time: 2024-10-27 16:16:04
GoVersion: go1.23.2
Race Enabled: false
Check Table Before Drop: false
Store: tikv

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.