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

Cast int string to JSON results in wrong type #21619

Closed
morgo opened this issue Dec 9, 2020 · 1 comment · Fixed by #21621
Closed

Cast int string to JSON results in wrong type #21619

morgo opened this issue Dec 9, 2020 · 1 comment · Fixed by #21621
Assignees
Labels
severity/minor sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@morgo
Copy link
Contributor

morgo commented Dec 9, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

select CAST("9223372036854775808" as json);
select json_type(CAST("9223372036854775808" as json));

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

mysql [localhost:8022] {msandbox} (test) > select CAST("9223372036854775808" as json);
+-------------------------------------+
| CAST("9223372036854775808" as json) |
+-------------------------------------+
| 9223372036854775808                 |
+-------------------------------------+
1 row in set (0.00 sec)

mysql [localhost:8022] {msandbox} (test) > select json_type(CAST("9223372036854775808" as json));
+------------------------------------------------+
| json_type(CAST("9223372036854775808" as json)) |
+------------------------------------------------+
| UNSIGNED INTEGER                               |
+------------------------------------------------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select CAST("9223372036854775808" as json);
+-------------------------------------+
| CAST("9223372036854775808" as json) |
+-------------------------------------+
| 9223372036854776000                 |
+-------------------------------------+
1 row in set (0.00 sec)

mysql> select json_type(CAST("9223372036854775808" as json));
+------------------------------------------------+
| json_type(CAST("9223372036854775808" as json)) |
+------------------------------------------------+
| DOUBLE                                         |
+------------------------------------------------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

mysql> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-1770-g51fbf415c
Edition: Community
Git Commit Hash: 51fbf415c904ad77b2a4c29fbfb3ff513ed60f8c
Git Branch: master
UTC Build Time: 2020-12-09 14:19:36
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)
@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants