Skip to content

TIME returns zero time instead of NULL for invalid time #59432

@YangKeao

Description

@YangKeao

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 TIME('');
+----------+
| TIME('') |
+----------+
| NULL     |
+----------+
1 row in set, 1 warning (0.02 sec)

mysql> SELECT TIME('NOT_A_TIME');
+--------------------+
| TIME('NOT_A_TIME') |
+--------------------+
| NULL               |
+--------------------+
1 row in set, 1 warning (0.00 sec)

3. What did you see instead (Required)

mysql> SELECT TIME('');
+----------+
| TIME('') |
+----------+
| 00:00:00 |
+----------+
1 row in set, 1 warning (0.00 sec)

mysql> SELECT TIME('NOT_A_TIME');
+--------------------+
| TIME('NOT_A_TIME') |
+--------------------+
| 00:00:00           |
+--------------------+
1 row in set, 1 warning (0.00 sec)

4. What is your TiDB version? (Required)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions