pingcap / pingcap/tidb

`MINUTE` cannot return correct minutes for truncated value

Open
#59,431 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.