Skip to content

docs: give each in-memory operation its real reason (#402) - #403

Merged
CaffeinatedCoder merged 4 commits into
mainfrom
docs/402-in-memory-reasons
Oct 25, 2026
Merged

CaffeinatedCoder merged 4 commits into
mainfrom
docs/402-in-memory-reasons

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #402

Stacked on PR #400 (#399), which adds rows to the same table; merge that one first.

Problem

docs/efcore.md#what-runs-where, and the pages and XML comments that repeat it, explained each in-memory operation by what PostgreSQL lacks. Several reasons were wrong or stale, and the opening implied that no dedicated operator means no translation, which Gap and Gaps already contradict. Two promises were broader than EF Core: "inside a Select it is safe" (only the final projection runs on the client) and "use these in Where, OrderBy and Select" (a value set Union composes only under some operators). #402 has the table of each stated reason against what holds.

Change

  • docs/efcore.md#what-runs-where:
    • The opening separates "composed SQL could do it, not written" from "SQL would answer differently", and names Gap/Gaps as composed translations.
    • The "Runs as SQL" lead links the Union composition rules.
    • Every in-memory row says what holds. Shift/Expand no longer claims an infinity difference: since Shift/Expand turn a bound that stands for ±infinity into a finite date #224 both sides keep it.
    • The "Good to know" bullet says the final Select.
  • The same reasons, corrected where they're repeated:
    • the EF Core, EF Core NodaTime and core READMEs (absolute links kept);
    • getting-started.md, value-sets.md, ranges.md and testing.md;
    • AGENTS.md;
    • the XML docs on Split, Values, Shift and Expand of all 13 range types ("an EF Core query doesn't translate it" instead of a wrong cause), SetRangeBridge and ValueSetRangeExtensions.
  • Claim E31: its quote follows the narrowed lead sentence ("in the final projection").
  • Changelogs: a Docs: row under ### Fixed in [11.0.0-preview.1] of all five.

No translation decision changes.

Tests

  • Every SQL statement in the new text was run on PostgreSQL 16 (2026-10-25):
    • upper(r)::int8 - lower(r)::int8 gives 4294967295 for [-2147483648,2147483647); without the cast it fails with integer out of range;
    • a date or timestamp range open to infinity fails with cannot subtract infinite dates / timestamps;
    • ARRAY(SELECT generate_series(…)) gives {1,2,3};
    • range_agg over singletons gives {[1,4),[7,8)};
    • LEAST(GREATEST(15, NULL), 9) gives 10 for (,10];
    • unnest … WITH ORDINALITY filtering gives {a,e};
    • subscripts [0]/[3] are NULL;
    • unnest over a multirange counts 2 and picks [5,7);
    • rebuilding the empty range gives (,);
    • '23:00'::time + 2 h gives 01:00;
    • '9999-12-30'::date + 5 gives 10000-01-04.
  • The infinity behaviour of Shift is InfinityShiftRoundTripTests.
  • The build passes (warnings as errors). The conventions (409) and ASP.NET Core (92) tests pass.

The 10.x half follows as a cherry-pick stacked on PR #401.

🤖 Generated with Claude Code

What runs where explained the in-memory operations by what PostgreSQL
lacks, and several reasons were wrong. Measured on PostgreSQL 16:
- Shift/Expand: a bound at infinity stays there since #224, so "an
  infinity date absorbs the step" was stale. The empty range, time past
  midnight and a date past .NET's last one still differ.
- Length: upper(r)::int8 - lower(r)::int8 widens fine; a temporal range
  open to infinity fails in PostgreSQL ("cannot subtract infinite dates").
- Values/Split: ARRAY(SELECT generate_series(...)) is one value.
- Bridge conversions: built-in range_agg over one-element ranges, no
  custom aggregate.
- Clamp: LEAST/GREATEST skip NULL; one branch for empty, one step for a
  discrete upper bound.
- Value set Intersect/Except: unnest WITH ORDINALITY keeps the left
  order, canonical only over canonical rows. Add sorts by collation.
- The indexers: subscripting reads stored order; a RangeSet's Count and
  indexer are a subquery over unnest.
An in-memory member runs in the final Select only, and Union composes
only under some operators. The decisions don't change.

The same reasons are corrected in the READMEs, getting-started,
value-sets, ranges, testing, AGENTS.md and the XML docs on Split,
Values, Shift and Expand of every range type. Claim E31 follows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 10.2.0 milestone Oct 25, 2026
@CaffeinatedCoder CaffeinatedCoder added documentation Improvements or additions to documentation area/ranges Range unions, variants and the shape engines area/range-set RangeSet and multirange algebra area/value-sets Value set families and wrapper arities package/nodatime Affects CodoMetis.ValueRanges.NodaTime package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/core Affects CodoMetis.ValueRanges package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime stacked Base is another open PR; merge in order, CI does not run until it targets main labels Oct 25, 2026
CaffeinatedCoder and others added 2 commits October 25, 2026 08:13
…ct markers (#402)

The previous commit merged the base branch with its conflicts left in
CHANGELOG.md, three package changelogs and docs/efcore.md. Keeps this
branch's rows, the #399 changelog row without its calendar sentence,
and the calendar factory row as "not translated yet" linking #191.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Base automatically changed from docs/399-what-runs-where to main October 25, 2026 09:32
@CaffeinatedCoder
CaffeinatedCoder merged commit 9cab055 into main Oct 25, 2026
11 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the docs/402-in-memory-reasons branch October 25, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/range-set RangeSet and multirange algebra area/ranges Range unions, variants and the shape engines area/value-sets Value set families and wrapper arities documentation Improvements or additions to documentation package/core Affects CodoMetis.ValueRanges package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime package/nodatime Affects CodoMetis.ValueRanges.NodaTime stacked Base is another open PR; merge in order, CI does not run until it targets main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: the in-memory reasons overstate what PostgreSQL lacks, and the Shift/Expand one is stale since #224

1 participant