Skip to content

New package CodoMetis.ValueRanges.EFCore.PostgreSQL.SchemaKit: typed Overlaps for range and range set columns in SchemaKit's exclusion constraints #540

Done

Description

@CaffeinatedCoder

Problem

On the 11 line, exclusion constraints come from CodoMetis.EFCore.SchemaKit.PostgreSQL. Its Overlaps takes Npgsql's own types only (NpgsqlRange<T>, its nullable form, NpgsqlRange<T>[] and List<NpgsqlRange<T>>), so a column of this package is written through the unchecked form:

pg.Exclusion(pg.Equal(x => x.RoomId).WithUncheckedOperator(x => x.Period, "&&"))   // Period : DateRange

WithUncheckedOperator takes any type and any operator, and PostgreSQL says what is wrong only when the migration is applied. SchemaKit's design gives the typed form to a satellite in this repository (design, section 10.2, decision Q12 of its plan), and its plan names that satellite as the first package outside its repository to compile against it, in its preview.3.

Change (main only)

A fifth package, src/CodoMetis.ValueRanges.EFCore.PostgreSQL.SchemaKit/, for net11.0:

  • It references this repository's EF package and CodoMetis.EFCore.SchemaKit.PostgreSQL. Nothing else here references SchemaKit, so the EF package keeps no SchemaKit dependency.
  • Extension members on SchemaKit's ExclusionDraft<TEntity> and ExclusionElements<TEntity>: one Overlaps per range type and per range set type, each built on WithUncheckedOperator(…, "&&"). Then pg.Equal(x => x.RoomId).Overlaps(x => x.Period) compiles for a DateRange, and Overlaps(x => x.Name) doesn't.
  • No contributor, no differ and no generator: the package writes no SQL of its own. MigrationServiceOwnershipConventionTests holds that as it does for the other four.
  • While SchemaKit is a preview, the reference names one version exactly. Its previews change the API and the stored form between them (preview.2 refuses a snapshot scaffolded with preview.1).
  • Its own CHANGELOG.md, a package README and a section in docs/efcore.md. The cross-tests and the smoke consumer of main: re-enable the cross-tests and the joint smoke consumer against CodoMetis.EFCore.SchemaKit.PostgreSQL #333 move from the unchecked form to the typed one.

Packaging. A stable package can't depend on a prerelease (NU5104), and v11.0.0 doesn't wait for SchemaKit (#147). So this package ships as 11.0.0-preview.N with the other four while Version is a prerelease, and is left out of the pack when Version is stable and SchemaKit is not. The conventions, the changelog checks, the release-notes target and the smoke test discover every project under src/ and assume one Version for all of them, so the hold-back is one explicit rule with a test that fails without it (seed: pack a stable version with the prerelease reference in place). #541 ships the package as a stable one.

To decide

  • The NodaTime types. No range interface is free of the element type (IRange<T>, IRangeFactory<TRange, T>), and C# doesn't infer T from a constraint, so one generic Overlaps<TRange> can't cover every range today. With an overload per type, the four NodaTime ranges and their sets need a reference to CodoMetis.ValueRanges.NodaTime: either this package takes it and every user gets NodaTime, or there is a sixth package. A non-generic marker interface in the core would let one overload cover all of them, as an addition to the core's surface.
  • A constraint that starts with the range. In preview.2, PgSchema<TEntity> has Equal and Overlaps and no WithUncheckedOperator; only the two stage types have it. If there is no other public way in, pg.Overlaps(x => x.Period) as the first element can't be written from outside, and that is an issue for SchemaKit.
  • Which operators. SchemaKit has Overlaps only. -|- and the others stay with WithUncheckedOperator unless a use turns up.

What it does not show

SchemaKit's contract freezes at rc.1, after a contributor outside its repository has compiled against it (CaffeinatedCoder/CodoMetis.EFCore.SchemaKit#120). This package is vocabulary only. It compiles against the declaration surface and never touches SchemaContributor<,>, Plan or ImpactOf, so it doesn't stand in for that contributor.

Blocked by

Done when

  • 11.0.0-preview.N of the package is on nuget.org beside the other four.
  • A compile probe holds that Overlaps over a property that isn't a range or range set of this package does not compile.
  • The exclusion cross-tests use the typed form and reject an overlap on PostgreSQL 16 and 18.
  • A stable Version packs four packages while SchemaKit is a prerelease, and a test fails when the fifth is packed with it.

As built (#592)

  • The NodaTime types: the package references CodoMetis.ValueRanges.NodaTime and has an overload per type, NodaTime's included (13 range types, 13 range set types). Every user of the package gets NodaTime; no sixth package and no core marker interface. Open for the maintainer to confirm before 11.0.0.
  • A constraint that starts with the range: PgSchema<TEntity> has WithUncheckedOperator since SchemaKit preview.3, so pg.Overlaps(x => x.Period) is in the package too. No SchemaKit issue needed.
  • Which operators: Overlaps only.
  • Pin: [11.0.0-preview.3] in the PR; it moves to [11.0.0-preview.4] once that is on nuget.org (the stage types are unchanged on SchemaKit main since preview.3).
  • Packaging: not packable at a stable Version while SchemaKitVersion is a prerelease; PackagingConventionTests evaluates every project at both kinds of Version, and the smoke test checks the feed.

Activity

  1. added this to the 11.0.0 milestone on Nov 28, 2026
  2. added
    enhancement
    area/ranges
    area/range-set
    package/efcore
    area/release
    on Nov 28, 2026
  3. added a commit that references this issue on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/range-setarea/rangesarea/releaseenhancementpackage/efcore

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions