fix(function): reject binary regexp operands and add match type overloads - #26724
Draft
ck89119 wants to merge 17 commits into
Draft
fix(function): reject binary regexp operands and add match type overloads#26724ck89119 wants to merge 17 commits into
ck89119 wants to merge 17 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #25299
What this PR does / why we need it:
MySQL rejects statically typed binary-character-set operands used by
REGEXP,NOT REGEXP, and theREGEXP_*functions with error 3995 (HY000). MatrixOne previously let the generic fixed-type matcher castBINARY,VARBINARY, andBLOBoperands toVARCHARbefore regexp validation, so these expressions executed instead of failing.This change:
REGEXP_LIKE,REGEXP_INSTR,REGEXP_SUBSTR, andREGEXP_REPLACE;HY000, including the correct function name and operand order;PARAM_ITEMandNULL_ITEMexceptions, so SQL/binary-protocol prepared parameters, binary NULL, and explicit character casts remain valid;match_typeoverloads forREGEXP_INSTR,REGEXP_SUBSTR, andREGEXP_REPLACE, includingc,i,m,n, andubehavior;return_option, and replacement capture expansion;An explicit empty
match_typepreserves MatrixOne's existing case-sensitive default. Matching MySQL's collation-derived default would require propagating collation metadata into the function executor and is outside this change.Validation:
make build.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/common/moerr ./pkg/sql/plan/function ./pkg/sql/plan ./pkg/frontend -count=1.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/issues -run '^TestIssue25299RegexpRejectsBinaryCharset$' -count=1 -timeout 5mgit diff --checkmo-self-reviewon the complete diff