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 Values() and Values(step) on the discrete ranges #651
the result an IEnumerable<T> EF Core can read as an array of the element (to be measured: whether Npgsql materializes IEnumerable<T> from a T[] mapping, or whether this needs the element's array mapping of our own);
the empty range as {}, NULL as NULL, unbounded raising as memory throws;
SQL asserted without a database, a live parity test on 16 and 18 per type (empty, NULL, one value, steps that do and do not divide the length, extremes, unbounded), translation-support.json and docs/efcore.md#what-runs-where updated, claim + seed.
Measured (2026-11-30, main @ fc87c98, no database: IRelationalTypeMappingSource.FindMapping on a context with UseValueRangesNodaTime()): Npgsql already maps IEnumerable<T> for four of the five elements. It returns its own NpgsqlArrayTypeMapping with an NpgsqlArrayConverter (reads T[], hands back the interface):
CLR type
store type
IEnumerable<int>
integer[]
IEnumerable<long>
bigint[]
IEnumerable<DateOnly>
date[]
IEnumerable<LocalDate>
date[]
IEnumerable<YearMonth>
none: the element is this library's (a month-aligned date), so its array mapping is ours to add, as YearMonthSet does
So the translator can take FindMapping(typeof(IEnumerable<T>)) for the BCL and LocalDate elements. A live read is still owed: the converter is only exercised when a row is materialized. #650's ValueSetSqlGuard.Values (unnest + generate_series, the date extremes, the unbounded raise) is the builder to extend. A single range can go in as multirange(r), and step adds a third generate_series argument (step * INTERVAL '1 day' for dates, months for YearMonth), with a raise for step <= 0.
Activity
CaffeinatedCoder commentedon Nov 30, 2026
Measured (2026-11-30, main @ fc87c98, no database:
IRelationalTypeMappingSource.FindMappingon a context withUseValueRangesNodaTime()): Npgsql already mapsIEnumerable<T>for four of the five elements. It returns its ownNpgsqlArrayTypeMappingwith anNpgsqlArrayConverter(readsT[], hands back the interface):IEnumerable<int>integer[]IEnumerable<long>bigint[]IEnumerable<DateOnly>date[]IEnumerable<LocalDate>date[]IEnumerable<YearMonth>date), so its array mapping is ours to add, asYearMonthSetdoesSo the translator can take
FindMapping(typeof(IEnumerable<T>))for the BCL andLocalDateelements. A live read is still owed: the converter is only exercised when a row is materialized. #650'sValueSetSqlGuard.Values(unnest+generate_series, the date extremes, the unbounded raise) is the builder to extend. A single range can go in asmultirange(r), andstepadds a thirdgenerate_seriesargument (step * INTERVAL '1 day'for dates, months forYearMonth), with a raise forstep <= 0.