`MINUTE` cannot return correct minutes for truncated value
Open
Nobody has claimed this yet.
component/expression
severity/moderate
sig/execution
type/bug
- Dominant language
- Go
- Stars
- 40.6k
- 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)
2. What did you expect to see? (Required)
mysql> SELECT MINUTE('12:30:00+05:00');
+--------------------------+
| MINUTE('12:30:00+05:00') |
+--------------------------+
| 30 |
+--------------------------+
1 row in set, 1 warning (0.02 sec)
mysql> show warnings;
+---------+------+--------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------+
| Warning | 1292 | Truncated incorrect time value: '12:30:00+05:00' |
+---------+------+--------------------------------------------------+
1 row in set (0.06 sec)
3. What did you see instead (Required)
mysql> SELECT MINUTE('12:30:00+05:00');
+--------------------------+
| MINUTE('12:30:00+05:00') |
+--------------------------+
| NULL |
+--------------------------+
1 row in set, 1 warning (0.01 sec)
mysql> show warnings;
+---------+------+--------------------------------------------------+
| Level | Code | Message |
+---------+------+--------------------------------------------------+
| Warning | 1292 | Truncated incorrect time value: '12:30:00+05:00' |
+---------+------+--------------------------------------------------+
1 row in set (0.00 sec)
4. What is your TiDB version? (Required)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the SELECT MINUTE('12:30:00+05:00') query and compare its result and warning with the expected output in the report. Trace the MINUTE expression's handling of the truncated time value, then add coverage showing that the function returns 30 while preserving the warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mysql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100