Skip to content

TPC with a concrete base: complex indexes, exclusion and temporal constraints land on the base table only #93

Closed

Description

@CaffeinatedCoder

Problem

In a TPC hierarchy with a concrete base type, exclusion constraints, temporal constraints and complex indexes declared on the base land on the base table only. EF Core's own HasIndex on the same base is created on every concrete table.

modelBuilder.Entity<TpcBooking>().UseTpcMappingStrategy();   // concrete base, table "bookings"
modelBuilder.Entity<TpcSpecialBooking>();                   // table "special_bookings"
b.HasExclusionConstraint(x => x.RoomId, x => x.During);     // on TpcBooking

On PostgreSQL 18, overlapping rows are refused in bookings and accepted in special_bookings. The abstract-base case already throws (5.1.0, ThrowIfDeclaredOnUnmappedType); the concrete-base case passes silently.

(The core analysis notes that EF Core 10 leaves complex-property columns out of a derived TPC table in some shapes; the scalar-column case above is unaffected by that.)

Fix

Emit each declaration per concrete table of the hierarchy, as EF does for indexes, or throw as for the abstract base. Either changes an answer: a minor with a ### Changed answers row.

Found by the 5.5.0 pre-tag analysis (PostgreSQL satellite).

Activity

  1. added this to the 5.6.0 milestone on Oct 19, 2026
  2. added
    bug
    silent
    severity/medium
    package/core
    package/postgresql
    area/indexes
    area/constraints
    on Oct 19, 2026
  3. modified the milestones: 5.6.0, 5.5.0 on Oct 20, 2026
  4. added
    breaking
    on Oct 20, 2026
  5. added 2 commits that reference this issue on Oct 20, 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/constraintsarea/indexesbreakingbugpackage/corepackage/postgresqlseverity/mediumsilent

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions