6

TiDB 的日期比较和 MySQL 不兼容

 2 years ago
source link: https://blog.est.im/2021/stdout-011
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

TiDB 的日期比较和 MySQL 不兼容

Posted 2021-09-07 | stdout

MySQL的

> select VERSION()
+-----------+
| VERSION() |
+-----------+
| 8.0.15-6  |
+-----------+


> select NOW() > '';
+------------+
| NOW() > '' |
+------------+
| 1          |
+------------+

> show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect datetime value: '' |
+---------+------+----------------------------------------+

TiDB:

> select VERSION()
+--------------------+
| VERSION()          |
+--------------------+
| 5.7.25-TiDB-v5.1.0 |
+--------------------+
1 row in set

> select NOW() > '';
+------------+
| NOW() > '' |
+------------+
| <null>     |
+------------+

> show warnings;
+---------+------+------------------------------+
| Level   | Code | Message                      |
+---------+------+------------------------------+
| Warning | 1292 | Incorrect datetime value: '' |
+---------+------+------------------------------+
1 row in set

记录一下 相关 issue

btw 顺便吐槽一下,

json_extract('{"a": null}', '$.a') 返回的值是 CAST('null' AS JSON)

注意区分 json_extract('{"a": null}', '$.b') IS NULL


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK