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 other types to JSON when compared with JSON value #37403

Closed
Tracked by #36993
YangKeao opened this issue Aug 26, 2022 · 0 comments · Fixed by #37404
Closed
Tracked by #36993

Cast other types to JSON when compared with JSON value #37403

YangKeao opened this issue Aug 26, 2022 · 0 comments · Fixed by #37404
Assignees
Labels
component/json type/enhancement The issue or PR belongs to an enhancement.

Comments

@YangKeao
Copy link
Member

Enhancement

In MySQL 5.7:

1149   if (type != ROW_RESULT &&
1150       (((*a)->result_type() == STRING_RESULT &&
1151         (*a)->field_type() == MYSQL_TYPE_JSON) ||
1152        ((*b)->result_type() == STRING_RESULT &&                                                                                                                                     
1153         (*b)->field_type() == MYSQL_TYPE_JSON)))
1154   {
1155     // Use the JSON comparator if at least one of the arguments is JSON.
1156     is_nulls_eq= is_owner_equal_func();
1157     func= &Arg_comparator::compare_json;
1158     return 0;
1159   }

If one of the compare args is json value, the other should be casted to json.

@YangKeao YangKeao added the type/enhancement The issue or PR belongs to an enhancement. label Aug 26, 2022
@YangKeao YangKeao self-assigned this Aug 26, 2022
@VelocityLight VelocityLight added cherry-pick-approved Cherry pick PR approved by release team. and removed cherry-pick-approved Cherry pick PR approved by release team. labels Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/json type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants