Repository navigation
[9.0] GroupJoin + SelectMany: Any() asks whether the join has a row (backport from #5911) - #5917
Merged
Merged
Conversation
…rt from #5911) Any() over a GroupJoin/SelectMany selected from the outer CTE alone, so it ignored the join and every filter on its inner side and answered true for any outer row. It now wraps the join in a CTE first, the same wrap Count() already had. Backport of the first of the two GroupJoin fixes in #5911 (10.0). The second, refusing an inner-side Where() after a left join, turns a wrong result into an exception and stays a 10.0 behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 16, 2026
This was referenced Nov 23, 2026
This was referenced Nov 27, 2026
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.
Backport to the 9.x line of the
GroupJoinAny()fix from #5911 (Marten 10; merged to master asac3536902).The bug
Any()/AnyAsync()over aGroupJoin+SelectManyquery selected from the outer CTE alone. So it ignored the join and any filter on the inner side, and returned true whenever outer rows existed:Count()already wrapped the join in a CTE before counting.Any()now does the same: a 19-line block inCollectionUsage.Compilation.cs, identical to master's.Deliberately not backported
#5911's second
GroupJoinfix makes Marten refuse aWhere()on the inner side after a left join (DefaultIfEmpty()), which today returns wrong rows. It turns a wrong result into an exception, so it stays a 10.0 behaviour change rather than going into a 9.x minor.Verification (net10.0, PostgreSQL 17)
group_join_operator.GroupJoin_with_Any_asks_about_the_join_rather_than_the_outer_side(copied from LINQ: translate Join and LeftJoin via the GroupJoin/SelectMany path (Fixes #5910) #5911) fails onorigin/9.0without the fix (27/28) and passes with it (28/28).Note that
tests.ymlruns only formaster, so this PR gets no CI checks unless the workflow is started by hand:gh workflow run tests.yml --repo JasperFx/marten --ref fix/groupjoin-any-9.0🤖 Generated with Claude Code