You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Translate the calendar factories when they read a column #191
#48 (PR #190) adds DateRange.Month, Quarter, Year and IsoWeek, and the same on LocalDateRange (Quarter and Year on YearMonthRange). Called with values the query does not read, EF evaluates them in memory and inlines one daterange constant, so b.Period.Overlaps(DateRange.Month(2026, 10)) runs as SQL. Called with a column, such as DateRange.Month(b.Day), they fail translation in a Where and run in memory in a Select. docs/efcore.md#what-runs-where lists them as "not translated yet".
Proposed translation (each a [) constructor, so no canonicalization is needed):
Quarter(date), Year(date) → the same with 'quarter' and 'year'
IsoWeek(date) → date_trunc('week', d), which is ISO (Monday) in PostgreSQL, plus 7 days
Month(y, m), Quarter(y, q), Year(y) → make_date(y, m, 1) and interval arithmetic
IsoWeek(weekYear, week) → to_date(weekYear || '-' || week, 'IYYY-IW'), which needs checking against ISOWeek for week 53 of a 52-week year, since the in-memory factory throws there
What to measure first: argument validation. In memory, month 13 or week 53 of a 52-week year throws ArgumentOutOfRangeException. make_date(2026, 13, 1) raises in PostgreSQL, but to_date may roll over, which would be a silent difference. The infinity date extremes (date_trunc('month', 'infinity')) also need checking.
Done when: the column forms run as SQL, a live test compares them with the in-memory answer for every factory over a span of dates, and the row leaves "runs in memory only".
Plan (2026-10-18): not part of the 10.0.0 epic (#58). The column forms are additive (a translation failure becomes a working query), so this ships as a 10.x minor, 10.1.0 at the earliest, after the measurements the issue names (to_date rollover on week 53, date_trunc on the date extremes). 10.0.0 tags with the "runs in memory only" row in docs/efcore.md#what-runs-where.
Activity
CaffeinatedCoder commentedon Oct 18, 2026
Plan (2026-10-18): not part of the 10.0.0 epic (#58). The column forms are additive (a translation failure becomes a working query), so this ships as a 10.x minor, 10.1.0 at the earliest, after the measurements the issue names (
to_daterollover on week 53,date_truncon the date extremes). 10.0.0 tags with the "runs in memory only" row indocs/efcore.md#what-runs-where.