Skip to content

An object on a column only a derived type has cannot be declared while the type shares its table #85

Open

Description

@CaffeinatedCoder

Decided 2026-11-12 by the maintainer: option 2. A declaration on the base type gets a way to name a column of a derived type that shares the table, so that a declaration always sits on the type that owns the table and always means the whole table. Not built now: it needs a path that says which derived type a property belongs to, which is a decision about the stored form in the resolver's first epoch, so it is scheduled with #43. preview.1 ships with the case refused, and the migration guide says so (#73). Option 1 is out: it would put back a judgement about when a table-wide object is really one type's.


Follows from #82, where a declaration on a derived type that shares its table is refused.

What is missing

Stay and Hold share the table of Reservation, and Stay alone has GuestId. An object that reads GuestId cannot be declared at all:

5.x accepted the declaration on Stay. A model that has one cannot move over as it is.

To decide

Such an object is less of a trap than the one #82 refuses: the sibling types' rows hold NULL in the column, and an exclusion element or a unique key that is NULL conflicts with nothing. That is not true of a column the condition alone reads. Options:

  1. Allow a declaration on a derived type when an element or key of it is a column only that type has. This is a rule about what the object's parts are, so it is the contributor's to state, not the kernel's.
  2. A way to name a derived type's column from the base type's declaration.
  3. Leave it refused and say so in the migration guide (Migration guide: every EFCore.ComplexIndexes 5.x usage, and its native EF Core 11 or SchemaKit form #73).

Activity

  1. added this to the 11.0.0 milestone on Nov 12, 2026
  2. added
    enhancement
    package/core
    package/postgresql
    area/constraints
    on Nov 12, 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/constraintsenhancementpackage/corepackage/postgresql

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions