Repository navigation
feat: run text value set operations as SQL where order and repeats don't count, on 10.x (port of #485, #497) - #501
Merged
Conversation
…n't count (#485) PostgreSQL can't sort text as memory does (#479), so on StringSet and StringSet<T> Intersect, Except and Add ran in memory only, and Count, == and != over a server-side text Union threw. Most uses don't depend on order or repeats, so the translator now emits unguarded placeholders for all four and ValueSetSqlGuard builds them unsorted (array_cat, or a filter of the first array) where the walker allows: @>, <@, &&, IsEmpty, a null test and the outermost projection, as for Union before. Two more uses are rewritten: - cardinality over one becomes (SELECT count(DISTINCT x) FROM unnest(...)), NULL for a NULL set; - =, <> and EF Core 11's NULLIF with one on a side become mutual containment, a @> b AND b @> a. A stored-column = keeps = and its index. No COLLATE "C": a collated operand costs a GIN index its use, and #483 makes a string set column compare bytes. Grouping, DISTINCT, ORDER BY, deduplicating set operations, IN over several sets and UPDATE setters stay refused. UnionNamer's renaming moves into the expander, which recognizes a derived value structurally plus the walker's derived subquery columns, and ValueSetsMemberTranslator no longer declines Count over a visible union. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 01b2df2)
…refusal seed (#485) text-set-count-counts-repeats leaves Count as cardinality, and text-set-equality-compares-arrays rewrites == only when both sides are a text operation; CanonicalSetOperationParityTests and UnionCanonicalityTests catch both. union-equality-not-refused removed an equality refusal that no longer exists: equality over a text Union is rewritten now, and the second seed holds that rewrite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f4447a4)
…ment on 10.x too (#485) EF Core 10 writes a == b ? null : a as NULLIF as well; 10.x keeps that test in SetQueryTranslationTests, where main's EF Core 11 copy lives in EfCore11ShapeTests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CaffeinatedCoder
changed the base branch from
fix/496-reject-nondeterministic-string-set-collation-10.x
to
release/10.x
October 26, 2026 13:42
# Conflicts: # CHANGELOG.md # docs/efcore.md # src/CodoMetis.ValueRanges.EFCore.PostgreSQL/CHANGELOG.md
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 #497
Stacked on #500 (the #496 port): it builds on #483's guarantee that a string set column compares bytes.
Problem
On
release/10.x, textIntersect,ExceptandAddran in memory only, andCount,==and!=over a server-side textUnionthrew.mainruns them where order and repeats don't count since #485 (PR #493, merge commit 40c81da).Change
Cherry-picked with
-x: 01b2df2 and f4447a4 from PR #493.Add,IntersectandExcept. The guard builds them unsorted, writesCountascount(DISTINCT …)and==/!=/NULLIFas mutual containment, and keeps every other refusal.CanonicalSetOperationParityTests, the flippedUnionCanonicalityTestsandSetIntegrationTestscases, the no-database tests, the seedstext-set-count-counts-repeatsandtext-set-equality-compares-arrays,union-equality-not-refusedretired, docs, AGENTS.md, claims E17–E20, E35 and E82, andtranslation-support.json.DeclaredNullabilityTestsand the EF Core 11 shape tests exist only onmain, so their changes are left out.NULLIFtest inSetQueryTranslationTests, flipped in an extra commit.[10.4.0].Tests
On EF Core 10.0.0, PostgreSQL 16 and 18: unit, conventions, ASP.NET Core and no-database EF tests, and the integration suite (319 tests). On the newest-patch leg: the set tests. Both seeds are caught on 10.x. A trial merge of all four ports onto
release/10.xis green: 411 no-database and 346 integration tests on both servers.🤖 Generated with Claude Code