-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null datetime
is not compatible with MySQL
#9763
Comments
This problem should be solved at the "TIKV" layer ???
|
After investigation, the reason is that TiDB's builtin function As MySQL's documents describe:
And TiDB doesn't check if these DATETIME columns are declared as NOT NULL. |
Confirming this issue still exists in master: DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a datetime not null);
insert ignore into t1 values (0);
select * from t1 where a is null;
CREATE TABLE t2 (a date not null);
insert ignore into t2 values (0);
select * from t2 where a is null;
..
mysql> select * from t1 where a is null;
Empty set (0.01 sec)
mysql>
mysql> CREATE TABLE t2 (a date not null);
Query OK, 0 rows affected (0.09 sec)
mysql> insert ignore into t2 values (0);
Query OK, 1 row affected (0.02 sec)
mysql> select * from t2 where a is null;
Empty set (0.00 sec)
mysql> select tidb_version()
-> \G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-750-g8a661044c
Edition: Community
Git Commit Hash: 8a661044cedf8daad1de4fbf79a390962b6f6c3b
Git Branch: master
UTC Build Time: 2020-07-10 10:52:37
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec) |
I am going to close this as a duplicate of #10485 There is a discussion in this issue which shows some of the nuances of MySQL's behavior. I don't think it all makes sense, so it is categorized as a feature request and not a bug. Feedback welcome of course if there are known applications that are impacted. Thanks :-) |
Please edit this comment or add a new comment to complete the following informationDuplicate bug
Duplicate of #10485 |
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
In MySQL
In TiDB
tidb-server -V
or runselect tidb_version();
on TiDB)?SIG slack channel
#sig-exec
Score
Mentor
The text was updated successfully, but these errors were encountered: