Repository navigation
feat: translate Clamp on Int32Range, Int64Range and DecimalRange, on 10.x (port of #406, #441) - #442
Merged
Conversation
Clamp(value) ran in memory only. On the three types whose bounds read as
memory's it now runs as SQL with memory's answers:
CASE WHEN x IS NULL OR v IS NULL OR isempty(x) THEN NULL
ELSE LEAST(GREATEST(v, lower(x)), <upper>) END
where <upper> is the bound UpperBound() reads: upper(x) - 1 on int4range and
int8range, whose stored upper bound is exclusive, and upper(x) on numrange,
where memory returns an exclusive bound as it is. GREATEST and LEAST skip the
NULL an unbounded side gives, so a NULL range or value is tested first and
answers NULL (rule (c)). Measured on PostgreSQL 16, the extremes included.
Clamp on the other range types stays in memory. ClampParityTests holds every
condition on #408's parity list; translation-support.json classifies the
three closed types server through its except map, and the docs move the row.
(cherry picked from commit 5ffc7b6)
Ported to release/10.x for #441. The changelog row goes under [10.3.0].
Co-Authored-By: Claude Opus 5.5 <[email protected]>
CaffeinatedCoder
enabled auto-merge
October 25, 2026 15:50
Closed
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 #441
Port of #406 (PR #440, merged into
mainas 84dc121) torelease/10.x, for 10.3.0 (#408). Fixed only on this branch, so #441 is closed by hand after the merge.Problem
On this line
Clampruns in memory only on every range type, so a query can't filter or order by a clamped value.Change
5c17d43: cherry-pick of 5ffc7b6 (-x):Clamparm inValueRangesMethodCallTranslator, forInt32Range,Int64RangeandDecimalRange.ClampTranslationTests,ClampParityTestsand its seed.DateRange.Clamp.translation-support.json'sexceptmap, claims E31 and E74,docs/efcore.md#what-runs-where,docs/ranges.mdand the EF Core README.[10.3.0]### Added, after theLengthrow from 10.x: translate Length on Int32Range and Int64Range (port of #405) #438, in both changelogs.oracles.json, from context that differs between the lines. It gets only theClampParityTestsentry.Tests
Run on
release/10.xwith SDK 10.0.402 and EF Core 10.0.0:ClampParityTestsandTranslationSupportProbeTests. All passed.Clamparm removed: the 3 translation tests fail, and every parity call is "Untranslated".🤖 Generated with Claude Code