`MAKETIME()` silently truncates out-of-range values without warning
- 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)
```SQL
mysql> select @@sql_mode;
+-------------------------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode |
+-------------------------------------------------------------------------------------------------------------------------------------------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+-------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT MAKETIME(999999999,0,0);
+-------------------------+
| MAKETIME(999999999,0,0) |
+-------------------------+
| 838:59:59 |
+-------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
Empty set (0.00 sec)
```
### 2. What did you expect to see? (Required)
Emit one warning indicating truncation as MySQL 8.4.4
```SQL
mysql> select @@sql_mode, version();
+-----------------------------------------------------------------------------------------------------------------------+-----------+
| @@sql_mode | version() |
+-----------------------------------------------------------------------------------------------------------------------+-----------+
| ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION | 8.4.4 |
+-----------------------------------------------------------------------------------------------------------------------+-----------+
1 row in set (0.03 sec)
mysql> SELECT MAKETIME(999999999,0,0);
+-------------------------+
| MAKETIME(999999999,0,0) |
+-------------------------+
| 838:59:59 |
+-------------------------+
1 row in set, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+---------------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------------+
| Warning | 1292 | Truncated incorrect time value: '999999999:00:00' |
+---------+------+---------------------------------------------------+
1 row in set (0.01 sec)
```
### 3. What did you see instead (Required)
```SQL
mysql> show warnings;
Empty set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
```SQL
mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-beta.2.pre-1207-g229a104ba4
Edition: Community
Git Commit Hash: 229a104ba411e831602c0b18c95b02cdcb454957
Git Branch: master
UTC Build Time: 2026-02-06 02:01:40
GoVersion: go1.25.6
Race Enabled: false
Check Table Before Drop: false
Store: unistore
Kernel Type: Classic |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
Contributor guide
Research direction
Start by locating TiDB's MAKETIME implementation and related SQL warning tests, then run the provided SELECT and SHOW WARNINGS reproduction. Done means out-of-range hour values still truncate to the supported maximum and emit the expected truncation warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100