pingcap/tidb

ERROR 1105 (HY000): encoding failed

sayJason opened this issue · 0 comments

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE t1 (c1 BLOB);
INSERT INTO t1 VALUES ('');
SELECT c1 FROM t1 WHERE CAST(REVERSE(c1) AS TIME);

2. What did you expect to see? (Required)

A more friendly error should be returned. like in MySQL

mysql> SHOW WARNINGS;
+---------+------+------------------------------------------------+
| Level   | Code | Message                                        |
+---------+------+------------------------------------------------+
| Warning | 1292 | Truncated incorrect time value: '\xBA\xA7\xE4' |
+---------+------+------------------------------------------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> SELECT c1 FROM t1 WHERE CAST(REVERSE(c1) AS TIME);
ERROR 1105 (HY000): encoding failed

4. What is your TiDB version? (Required)

Release Version: v7.0.0
Edition: Community
Git Commit Hash: 7376954
Git Branch: heads/refs/tags/v7.0.0
UTC Build Time: 2023-03-29 13:32:13
GoVersion: go1.20.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv