pingcap / pingcap/tidb

Wrong Result in Cast Blob to Json

Open
#58,959 2 comments 0 reactions 0 assignees View on GitHub
component/json severity/minor sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```sql
DROP TABLE IF EXISTS t0;
CREATE TABLE t0(c0 BLOB);
INSERT INTO t0 VALUES ('1xx');

SELECT CAST(t0.c0 AS JSON) IS TRUE FROM t0;
```

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

see the following case:

### 3. What did you see instead (Required)

```sql
// TiDB
mysql> SELECT CAST(t0.c0 AS JSON) IS TRUE FROM t0;
+-----------------------------+
| CAST(t0.c0 AS JSON) IS TRUE |
+-----------------------------+
| 0 |
+-----------------------------+
1 row in set, 1 warning (0.04 sec)

// MySQL
MySQL [test]> SELECT CAST(t0.c0 AS JSON) IS TRUE FROM t0;
+-----------------------------+
| CAST(t0.c0 AS JSON) IS TRUE |
+-----------------------------+
| 1 |
+-----------------------------+
1 row in set, 1 warning (0.01 sec)
```

### 4. What is your TiDB version? (Required)

TiDB v8.5.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.