-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
expression: implement the Coercibility() function #14739
Conversation
if _, ok := sysConstFuncs[sf.FuncName.L]; ok { | ||
return CoercibilitySysconst | ||
} | ||
if !types.IsString(sf.RetType.Tp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if Bytes
, the collation is binary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mysql> create table tt (b binary(10), vb varbinary(10));
mysql> insert into tt values (null, null);
mysql> select coercibility(b), coercibility(vb) from tt;
+-----------------+------------------+
| coercibility(b) | coercibility(vb) |
+-----------------+------------------+
| 2 | 2 |
+-----------------+------------------+
After testing, it seems ok to use this function since the Tp
of Bytes(binary)
in TiDB
is 254(TypeString
) now.
/rebuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
@qw4990 merge failed. |
/run-integration-common-test |
1 similar comment
/run-integration-common-test |
/run-all-tests |
/run-all-tests |
What problem does this PR solve?
Solve this issue: #14687.
Implement the
Coercibility()
function for TiDB.What is changed and how it works?
CollationExpr
and implement it for all ourExpressions
deriveCoercibilityForXXX
functions according to this doc.Check List
Tests