Repository navigation
feat(analysis): type LIKE and ILIKE patterns and resolve null tests - #29
Merged
Merged
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.
Summary
Text search and null checks are common in everyday read queries, but a
LIKE $1orILIKE $1pattern placeholder was rejected, and anIS NULLtest was never checked against the schema. ALIKE/ILIKEpattern placeholder on a direct text column now becomes a typedStringmethod parameter. A direct-columnIS NULL/IS NOT NULLnow resolves its column against the query sources.Changes
<column> LIKE $Nand<column> ILIKE $Non a direct, optionally qualifiedVARCHARorTEXTcolumn produce one parameter typed from that column. They keep textual binding order and follow the existing repeated-index and contiguity rules, inSELECT,UPDATE, andDELETEWHEREclauses.<column> IS NULLandIS NOT NULLresolve their direct column, so an unknown, ambiguous, or badly qualified column is rejected. They bind no parameter.NOT LIKE,NOT ILIKE), another keyword such asSIMILAR TO, anESCAPEclause, aBINARYmodifier, a non-text tested column, or a placeholder as the tested value. A named:nameplaceholder in either operand keeps the existing named-parameter message.LIKE, case-insensitiveILIKE,IS NULL, andIS NOT NULLreads.%/_wildcards, the rejections, and the remaining unanalyzed forms.Scope and non-goals
LIKEpattern still reaches the database unanalyzed.'%' || $1 || '%', and a placeholder null test such as$1 IS NULL, stay rejected as unsupported placeholder locations.ISNULL/NOTNULLpostfix spellings andNOT (...)predicates are not analyzed.