Wrong result of Day when argument is an invalid datetime
Open
@gengliqi is already working on this.
Since Mar 11, 2022.
component/compute
severity/moderate
type/bug
- Dominant language
- C++
- Stars
- 1k
- Forks
- 423
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 24
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
drop table if exists test.t1; create table test.t1 (c_str varchar(100), c_datetime datetime(4), c_date date);
insert into test.t1 values('1999-30-10', '1999-10-10 10:10:10.123', '1999-01-10');
alter table test.t1 set tiflash replica 1;
set @@tidb_isolation_read_engines='tiflash'; set @@tidb_enforce_mpp = 1;
select c_str, day(c_str) from test.t1;
2. What did you expect to see? (Required)
mysql> select c_str, day(c_str) from test.t1;
+------------+-------------------+
| c_str | day(c_str) |
+------------+-------------------+
| 1999-30-10 | NULL |
+------------+-------------------+
mysql> show warnings;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1292 | Incorrect datetime value: '1999-30-10' |
+---------+------+----------------------------------------+
1 row in set (0.00 sec)
3. What did you see instead (Required)
MySQL [test]> select c_str, day(c_str) from test.t1;
+------------+-------------------+
| c_str | day(c_str) |
+------------+-------------------+
| 1999-30-10 | 10 |
+------------+-------------------+
4. What is your TiFlash version? (Required)
master Git Commit Hash: 52297259818d505956138a948facc9478ad0ea48
Contributor guide
No contributing guide indexed for this repository
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.
Assessment
This issue has not been assessed yet.