Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should not insert date sucessfully without explicit cast if the column type is json #51275

Open
zimulala opened this issue Feb 23, 2024 · 0 comments
Assignees
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) component/json severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@zimulala
Copy link
Contributor

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 #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

@zimulala zimulala added type/bug The issue is confirmed as a bug. sig/execution SIG execution component/json labels Feb 23, 2024
@zimulala zimulala changed the title Can't insert expression date if the column type is json。 Can't insert date if the column type is json。 Feb 23, 2024
@windtalker windtalker changed the title Can't insert date if the column type is json。 Should not insert date sucessfully if the column type is json Feb 23, 2024
@windtalker windtalker changed the title Should not insert date sucessfully if the column type is json Should not insert date sucessfully without explicit cast if the column type is json Feb 23, 2024
@windtalker windtalker added compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) severity/moderate labels Feb 23, 2024
@YangKeao YangKeao self-assigned this May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) component/json severity/moderate sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants