Repository navigation
feat: translate RangeSet.Count, on 10.x (port of #484, #495) - #499
Merged
CaffeinatedCoder merged 3 commits intoOct 26, 2026
Merged
Conversation
…484) RangeSet.Count ran in memory only: PostgreSQL has no multirange cardinality function, and #94's spike found a member translator can't build the subquery (no alias manager). #478 showed the way: the member translator emits a placeholder, and MultirangeCount builds (SELECT count(*)::int FROM unnest(x) AS vcN(r)) after EF Core's alias pass, from the same decorated processor as ValueSetSqlGuard, so it fails closed too. count(*) over unnest(NULL) is 0, so the placeholder sits inside CASE WHEN x IS NULL THEN NULL, which EF Core folds away for a required column. RangeSetCountParityTests measures every range type. A stored multirange counts as memory counts it, the extremes included. One the server computes from an operand at the element type's extreme can hold a range memory reads as empty, (,-2147483648) or (infinity,), the documented domain boundary; those rows are set aside and counted, and docs/efcore.md says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 2193825)
…or seed (#484) Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit c6be2cb)
Closed
# Conflicts: # src/CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime/CHANGELOG.md # test/oracles/claims.json
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 #495
Problem
RangeSet.Countruns as SQL onmainsince #484 (PR #491, merged as 848fc0f). Onrelease/10.xit ran in memory only.Change
Cherry-picked with
-x: 2193825 and c6be2cb from PR #491.MultirangeCount, the placeholder inValueRangesMemberTranslatorinside a NULLCASE, and the expansion in the decorated processor.RangeSetCountParityTests(an oracle) with the seedrangeset-count-of-a-null-multirange-is-zero,RangeSetCountTranslationTests, the fail-closed registration test, docs, claims E84, E85 and M06,translation-support.jsonandpostgres-surface.json.Processkeeps 10.x'sEmptyCollectionRewriter.Rewrite(…, TypeMappingSource)and wraps it inMultirangeCount.Expand.sql-processor-reuses-its-first-outputseed, so the refresh is left out.oracles.jsonkeeps 10.x's entries plusRangeSetCountParityTests.[10.4.0].Tests
On EF Core 10.0.0, PostgreSQL 16 and 18: conventions, no-database EF tests and the integration suite (331 tests). On the newest-patch leg: the
Count, multirange and repeated-execution tests. The seed is caught on 10.x.🤖 Generated with Claude Code