Skip to content

feat: translate Clamp on every range type, on 10.x (port of #486, #494) - #498

Merged
CaffeinatedCoder merged 3 commits into
release/10.xfrom
feat/494-translate-clamp-remaining-10.x
Oct 26, 2026
Merged

CaffeinatedCoder merged 3 commits into
release/10.xfrom
feat/494-translate-clamp-remaining-10.x

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #494

Problem

Clamp runs as SQL on every range type on main since #486 (PR #490, merged as ac9bd90). On release/10.x it ran as SQL only on Int32Range, Int64Range and DecimalRange.

Change

Cherry-picked with -x: 6048903, 521a11a and b68b98c from PR #490.

  • Translator: Clamp on every range type, plus MixesTimeZones, which declines a timestamptz value against a DateTimeRange's tsrange.
  • Tests and oracles: ClampDomainParityTests (an oracle) with the seed clamp-compares-a-timestamptz-value-through-the-session-zone, the widened clamp seed, ClampTranslationTests, the client-side-only rows, docs, and claims E31, E74 and E83.
  • 10.x differences: the changelog rows go under [10.4.0]. DeclaredNullabilityTests exists only on main, so its GREATEST/LEAST arm is left out.

Tests

On EF Core 10.0.0, PostgreSQL 16 and 18: conventions, no-database EF tests and the integration suite (330 tests). On CI's newest-patch leg (EF Core 10.0.13 / Npgsql 10.0.3): the Clamp tests. tools/oracles.cs seeds catches both clamp seeds on 10.x.

🤖 Generated with Claude Code

CaffeinatedCoder and others added 3 commits October 26, 2026 13:09
Clamp ran as SQL only on Int32Range, Int64Range and DecimalRange, the three
holds on the other ten types: ClampDomainParityTests measures each against
memory over every range its factories build from points that include the
element type's extremes, as a value column, a parameter and an inlined
constant, exactly and in both orderings.

One pairing stays in memory: a DateTime stored as timestamptz (Npgsql's
default) against a DateTimeRange's tsrange. GREATEST and LEAST convert the
range's bounds through the session's time zone; in a Europe/Berlin session
[08:00,18:00) clamped 17:30Z to 17:00Z. Contains and the factories already
fail on that pair, so Clamp now declines it too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 6048903)
…oracles (#486)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 521a11a)
…omain tests run alone (#486)

DeclaredNullabilityTests now records the GREATEST/LEAST Clamp emits on its
DateRange column; they are not pg_proc functions and skip a NULL argument.
The domain tests each seed a database of their own, so they run outside the
parallel batch rather than adding a dozen pools to the server's limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit b68b98c)
@CaffeinatedCoder CaffeinatedCoder added this to the 10.4.0 milestone Oct 26, 2026
@CaffeinatedCoder CaffeinatedCoder added enhancement New feature or request area/ranges Range unions, variants and the shape engines package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime labels Oct 26, 2026
@CaffeinatedCoder CaffeinatedCoder mentioned this pull request Oct 26, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit a5cc7da into release/10.x Oct 26, 2026
10 of 12 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the feat/494-translate-clamp-remaining-10.x branch October 26, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ranges Range unions, variants and the shape engines enhancement New feature or request package/efcore Affects CodoMetis.ValueRanges.EFCore.PostgreSQL package/efcore-nodatime Affects CodoMetis.ValueRanges.EFCore.PostgreSQL.NodaTime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant