pingcap / pingcap/tidb

TiDB date function inconsistent behavior with MySQL for zero dates

Open
#37,947 1 comment 0 reactions 0 assignees View on GitHub
severity/moderate 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 t1(a year);
insert into t1 values(2021);
select date(a) from t1;

### 2. What did you expect to see? (Required)
+---------+
| date(a) |
+---------+
| NULL |
+---------+
### 3. What did you see instead (Required)
+------------+
| date(a) |
+------------+
| 2021-00-00 |
+------------+
### 4. What is your TiDB version? (Required)
| Release Version: v6.3.0-alpha
Edition: Community
Git Commit Hash: 29f83a0b25926390c757f71a84baa2322a289f78
Git Branch: heads/refs/tags/v6.3.0-alpha
UTC Build Time: 2022-09-18 14:25:04
GoVersion: go1.19
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
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.