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

Differences in JSON type for casting YEAR as JSON #54494

Closed
YangKeao opened this issue Jul 8, 2024 · 0 comments · Fixed by #54146
Closed

Differences in JSON type for casting YEAR as JSON #54494

YangKeao opened this issue Jul 8, 2024 · 0 comments · Fixed by #54146
Labels
component/json severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@YangKeao
Copy link
Member

YangKeao commented Jul 8, 2024

Bug Report

This issue is part of #54027

1. Minimal reproduce step (Required)

SET NAMES utf8mb4 COLLATE utf8mb4_0900_ai_ci;
WITH tbl AS (SELECT CAST('2024' AS year) v) SELECT v,CAST(v AS JSON), JSON_TYPE(CAST(v AS JSON)) FROM tbl;

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

mysql-8.4.0> WITH tbl AS (SELECT CAST('2024' AS year) v) SELECT v,CAST(v AS JSON), JSON_TYPE(CAST(v AS JSON)) FROM tbl;
+------+-----------------+----------------------------+
| v    | CAST(v AS JSON) | JSON_TYPE(CAST(v AS JSON)) |
+------+-----------------+----------------------------+
| 2024 | 2024            | UNSIGNED INTEGER           |
+------+-----------------+----------------------------+
1 row in set (0.01 sec)

3. What did you see instead (Required)

mysql-8.0.11-TiDB-v8.1.0> WITH tbl AS (SELECT CAST('2024' AS year) v) SELECT v,CAST(v AS JSON), JSON_TYPE(CAST(v AS JSON)) FROM tbl; 
+------+-----------------+----------------------------+
| v    | CAST(v AS JSON) | JSON_TYPE(CAST(v AS JSON)) |
+------+-----------------+----------------------------+
| 2024 | 2024            | INTEGER                    |
+------+-----------------+----------------------------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

Release Version: v8.1.0
Edition: Community
Git Commit Hash: 945d07c5d5c7a1ae212f6013adfb187f2de24b23
Git Branch: HEAD
UTC Build Time: 2024-05-21 03:51:57
GoVersion: go1.21.10
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/json severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants