Skip to content

feat: run text value set operations as SQL where order and repeats don't count, on 10.x (port of #485, #497) - #501

Merged
CaffeinatedCoder merged 4 commits into
release/10.xfrom
feat/497-text-set-forms-10.x
Oct 26, 2026
Merged

CaffeinatedCoder merged 4 commits into
release/10.xfrom
feat/497-text-set-forms-10.x

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

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, text Intersect, Except and Add ran in memory only, and Count, == and != over a server-side text Union threw. main runs 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.

  • Code: unguarded placeholders for text Add, Intersect and Except. The guard builds them unsorted, writes Count as count(DISTINCT …) and ==/!=/NULLIF as mutual containment, and keeps every other refusal.
  • Tests and oracles: the text sweep in CanonicalSetOperationParityTests, the flipped UnionCanonicalityTests and SetIntegrationTests cases, the no-database tests, the seeds text-set-count-counts-repeats and text-set-equality-compares-arrays, union-equality-not-refused retired, docs, AGENTS.md, claims E17–E20, E35 and E82, and translation-support.json.
  • 10.x differences:
    • DeclaredNullabilityTests and the EF Core 11 shape tests exist only on main, so their changes are left out.
    • 10.x keeps its NULLIF test in SetQueryTranslationTests, flipped in an extra commit.
    • The guide keeps 10.x's Known differences in 10.2.0 section.
    • The changelog rows go under [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.x is green: 411 no-database and 346 integration tests on both servers.

🤖 Generated with Claude Code

CaffeinatedCoder and others added 3 commits October 26, 2026 13:16
…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 CaffeinatedCoder added this to the 10.4.0 milestone Oct 26, 2026
@CaffeinatedCoder CaffeinatedCoder added enhancement New feature or request area/value-sets Value set families and wrapper arities package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL stacked Base is another open PR; merge in order, CI does not run until it targets main labels Oct 26, 2026
@CaffeinatedCoder
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
@CaffeinatedCoder CaffeinatedCoder removed the stacked Base is another open PR; merge in order, CI does not run until it targets main label Oct 26, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit 61308c6 into release/10.x Oct 26, 2026
10 of 11 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the feat/497-text-set-forms-10.x branch October 26, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/value-sets Value set families and wrapper arities enhancement New feature or request package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant