Repository navigation
fix(postgresql): fold a captured Substring start as EF Core does - #124
Merged
Merged
Conversation
x.Code.Substring(start) with a captured int start rendered
substring("Code", (1 + 1)) where EF Core writes substring("Code", 2).
PostgreSQL folds the constant before it matches an index to a query, so
no answer changed; the rendering disagreed for no reason. A start known
at the declaration, literal or captured, is now folded. The templates it
changes are the ones #72 already re-creates in 5.5.0.
Verified with the change reverted: the new test fails and the parity
sweep fails the 20 rows this removes from waivers.txt. The four left
there are nullable != filters, shaped as #118 describes.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
CaffeinatedCoder
force-pushed
the
fix/117-substring-captured-start
branch
from
October 20, 2026 06:35
9f23cec to
8f592d5
Compare
CaffeinatedCoder
force-pushed
the
fix/94-concat-coalesce
branch
from
October 20, 2026 06:35
2b57fc3 to
a7e3927
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.
Closes #117
Stacked on #123 (#94) → #122 (#80) → #121 (#101); merge those first.
Problem
A typed expression index or filter whose
Substringstart is a captured variable renderedsubstring("Code", (1 + 1)); EF Core's query for the same lambda writessubstring("Code", 2). PostgreSQL folds the constant before it matches an index to a query (the live sweep confirms the index serves EF Core's query), so no answer changed, but the rendering disagreed with EF Core's for no reason.Change
NpgsqlLinqIndexTranslator.SubstringStart: a start with no parameter in it, a literal or a captured variable, is evaluated and folded. A start computed from the row stays(… + 1).waivers.txt: the Typed expression indexes: a captured Substring start renders unfolded, where EF Core folds it #117 block is gone. Its four remaining rows are nullable!=filters, which differ only in the null check's shape and move to the Typed filters: null checks over a computed operand and negated nullable comparisons are shaped unlike EF Core's #118 block.Substringas EF Core does.Tests
NpgsqlLinqExpressionIndexTests.Substring_start_is_folded.🤖 Generated with Claude Code