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
TPC with a concrete base: complex indexes, exclusion and temporal constraints land on the base table only #93
area/constraintsTemporal (WITHOUT OVERLAPS, PERIOD) and exclusion constraintsarea/indexesComplex-property, composite, unique and filtered indexesbreakingChanges an answer or a signature — needs a majorbugSomething isn't workingpackage/coreAffects EFCore.ComplexIndexespackage/postgresqlAffects EFCore.ComplexIndexes.PostgreSQLseverity/mediumInconsistency or failure in a narrow scenariosilentAnswers wrongly without throwing — fixes go in the next major, never deferred
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).
area/constraintsTemporal (WITHOUT OVERLAPS, PERIOD) and exclusion constraintsarea/indexesComplex-property, composite, unique and filtered indexesbreakingChanges an answer or a signature — needs a majorbugSomething isn't workingpackage/coreAffects EFCore.ComplexIndexespackage/postgresqlAffects EFCore.ComplexIndexes.PostgreSQLseverity/mediumInconsistency or failure in a narrow scenariosilentAnswers wrongly without throwing — fixes go in the next major, never deferred
Activity
proof: revert the per-table rule (counterfactual, #93)
fix: create declarations on a TPC type on every table of the hierarchy (
Merge pull request #131 from CaffeinatedCoder/fix/93-tpc-concrete-base