fix(filter)!: keep operator alias text inside a quoted value - #141
Merged
Merged
Conversation
pdevito3
force-pushed
the
fm/qk-breaking-alias-in-value
branch
from
October 1, 2026 21:37
1b22df7 to
f59a9a2
Compare
The alias rewrite before the parse replaced each alias that stands between whitespace, also inside a quoted value. Title eq "salt and pepper" compared with "salt && pepper". Read the aliases only in the grammar, so a quoted value does not change. The query-name rewrite accepts a comparison alias after the query name. BREAKING CHANGE: with custom operator aliases, alias text inside a quoted value is no longer replaced with its operator. The filter compares with the value as written.
pdevito3
force-pushed
the
fm/qk-breaking-alias-in-value
branch
from
October 3, 2026 12:03
f59a9a2 to
925f508
Compare
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
ParseFilterno longer runsReplaceLogicalAliasesandReplaceComparisonAliaseson the whole input before the parse. These two methods are removed.v1.14.2 behavior (and main)
The rewrite before the parse replaces every alias that stands between whitespace with its operator. It does not know about quotes, so it also changes the text inside a quoted value.
New behavior
An alias is an operator only where the grammar expects an operator. A quoted value keeps its text. This includes a value that holds a query name and an alias.
Example
x => ((x.Title == "salt && pepper || == gt") AndAlso (x.Rating > 3)).x => ((x.Title == "salt and pepper or eq gt") AndAlso (x.Rating > 3)).Justification
A quoted value is data. The parser must not change it. With the old rewrite, a caller with word aliases (
and,or,eq) cannot search for a value that holds one of these words.Migration
None for most callers. A caller that relied on the rewrite inside a quoted value must write the canonical operator in the value.
README
The Custom Operators section now tells that operator text inside a quoted value does not change.
Tests
OperatorAliasTests.alias_text_inside_quoted_value_is_not_replacedOperatorAliasTests.case_insensitive_alias_text_inside_quoted_value_is_not_replacedOperatorAliasTests.can_use_alias_operator_with_query_nameOperatorAliasTests.query_name_and_alias_text_inside_quoted_value_is_not_replaced:name eq "name eq x"givesx => (x.Title == "name eq x").FilterParsingRegressionTests.operator_alias_text_inside_quoted_value_is_kept(Postgres)dotnet test: 565 unit tests and 357 Postgres integration tests (Testcontainers) pass, 0 failures.Rebase on v2
The branch is rebased on v2. The
ReplaceQueryNamesWithPropertyPathshelper and the internalReplaceAliasesWithPropertyPathsoverload from the first version are removed, because v2 resolves query names in the grammar.