Skip to content

Landing function, slice 1: a declaration on a TPC type lands on every table of the hierarchy below it #187

Done

Description

@CaffeinatedCoder

2026-11-25: in PR #188 (feat/187-landings). Offline: 757 of the kernel's tests, 195 of the PostgreSQL package's, 87 of the second provider's. Live: 4 and 74 on PostgreSQL 16 and on 18, 86 on SQL Server 2022, the consumer smoke test's 47 rows.

What is there:

  • Landings.Of(entityType) in the kernel: the type's own table, and under TPC the table of every type derived from it that has one. The planner resolves the declaration once per table, on both sides of a diff; the refusal of A declaration on a concrete TPC root reaches the root's table only: the derived tables get no constraint, in silence #101 is gone, and an abstract TPC root lands on its derived types' tables.
  • A copy's name is made by the resolver's Name: a default name has its table in it; a stated name stays in the declaring type's own table and is {name}_{table} in a derived type's when the object's claims hold a NameClaim.Relation, and the name itself otherwise. The planner resolves a copy once to read its claims and again for the name.
  • The stored form and the contributor contract are unchanged.
  • A copy follows the rename of its own table: it is resolved again in that table, and what is left is a rename of the object.
  • On PostgreSQL 16 and 18 a constraint declared on the root of a TPC hierarchy is in all three tables, each refuses its own overlapping rows under its own constraint's name, and the catalog is what EnsureCreated() builds (On_the_root_of_TPC_each_table_refuses_its_own_overlapping_rows).

Found on the way:

  • A contributor that names an object without the resolver's Name gives every copy one name. That is refused as SK1001, not created twice (A_name_made_without_the_resolver_is_one_name_for_every_copy_and_is_refused). The kernel's sample contributor did so, and now sends a stated name through the resolver.
  • On EF Core 11 a complex property's column is in a TPC derived table too (the relational model of the scratch project; 5.x found the opposite on EF Core 10). So no path of a declaration is known to lack its column in a copy's table; the resolver's refusal of one that does stays.
  • No constraint holds across the tables: an overlapping stay and hold of one room are both taken. The README says so.

Deviation from the proposal on #118: a copy is resolved against the declaring entity type with the copy's table, not against the table's own entity type. The declaring type's property answers the column for every table of the hierarchy (measured), and the paths are the declaring type's.

Nine rules were changed in turn and a test failed for each:

Changed Fails
A TPC type has its own table alone 9 of the kernel's, A_constraint_on_a_type_of_TPC_is_in_every_table_of_the_hierarchy_below_it, the live test
Every hierarchy is treated as TPC The_landings_of_a_type_are_the_same_on_a_model_and_on_its_snapshot, A_snapshot_that_holds_one_is_read_and_moving_it_to_the_base_type_costs_nothing, A_constraint_on_a_derived_type_that_shares_its_table_is_refused
A derived type's table is no copy 7 of the kernel's, both of the PostgreSQL package's
The own table is a copy too 39 of the kernel's, 68 of the PostgreSQL package's
Every copy's name gets the table, whatever it claims A_name_that_is_taken_within_its_table_is_every_copys_name
No copy's name gets the table 7 of the kernel's, both of the PostgreSQL package's
Under a rename a copy is resolved in the declaring type's table A_copy_follows_the_rename_of_its_table
Under a rename a copy loses its suffix the same
A type without a table is passed over A_declaration_on_a_type_without_a_table_is_refused, added after the first run showed nothing held it

Not here: the 5.x reader and its fixture (slice 2), entity splitting and the TPT refusal (slice 3), #85's path.


Part of #118 (decided 2026-11-25). The first of three slices.

Problem

A declaration is resolved against the one table of the entity type it is written on. On a TPC type with derived types that have tables it is refused (#101), and on an abstract TPC root it is refused as not mapped to a table. EF Core gives an index declared there to every table of the hierarchy, and 5.x gave each table its copy.

Change

  • One function of the kernel says which tables a declaration lands on, each with the entity type to resolve against, used on both sides of a diff.
  • A TPC type: its own table if it has one, and the table of every derived type that has one. One object per table.
  • A copy whose table has no column for a path the declaration reads is refused, with the table named.
  • Names as 5.x: a default name has its table in it; with an explicit name the declaring type's own table keeps it, and a derived table's copy is {name}_{table} when the name is taken in the schema, and the name itself when it is taken within the table. A copy's name that is too long is refused.
  • The stored form and the contributor contract do not change. The refusal of A declaration on a concrete TPC root reaches the root's table only: the derived tables get no constraint, in silence #101 goes.

Not here: the 5.x reader and its fixture (slice 2), entity splitting and the TPT refusal (slice 3), #85's path.

Done when

SchemaResolverTests holds the landings on a model and its compiled snapshot, a derived type added later gets its copy by the next migration, and a live test on PostgreSQL shows each table of a TPC hierarchy refusing the row the constraint forbids.

Activity

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions