TiDB 的日期比较和 MySQL 不兼容
Posted | 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
Comments