Should not insert date sucessfully without explicit cast if the column type is json
- 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)
```
create table t5 (c int(10), c1 json default null);
insert into t5 values (1, str_to_date('1980-01-01','%Y-%m-%d'));
select * from t5;
```
Related issue https://github.com/pingcap/tidb/issues/50370.
### 2. What did you expect to see? (Required)
MySQL 8.0.18
```
mysql> create table t5 (c int(10), c1 json default null);
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> insert into t5 values (1, str_to_date('1980-01-01','%Y-%m-%d'));
ERROR 3140 (22032): Invalid JSON text: "not a JSON text, may need CAST" at position 0 in value for column 't5.c1'.
```
### 3. What did you see instead (Required)
```
tidb> create table t5 (c int(10), c1 json default null);
Query OK, 0 rows affected (0.04 sec)
tidb> insert into t5 values (1, str_to_date('1980-01-01','%Y-%m-%d'));
Query OK, 1 row affected (0.00 sec)
tidb> select * from t5;
+------+--------------+
| c | c1 |
+------+--------------+
| 1 | "1980-01-01" |
+------+--------------+
1 row in set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
master
Contributor guide
Assessment
This issue has not been assessed yet.