Repository navigation
feat: a declaration on a TPC type lands on every table of the hierarchy - #188
Merged
Merged
Conversation
Landings.Of says which tables a declaration lands on: the type's own, 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, so nothing of the copies is stored. The refusal of #101 goes, and a TPC root without a table 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 claims a name of the schema, and the name itself otherwise, as 5.x named its copies. A copy follows the rename of its own table. A contributor that names an object without the resolver gives every copy one name, which is refused as SK1001. Closes #187 Co-Authored-By: Claude Fable 5.2 <[email protected]>
CaffeinatedCoder
enabled auto-merge
November 25, 2026 11:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #187
The first of three slices of #118 (decided 2026-11-25).
Problem
A declaration was resolved against the one table of the entity type it is written on. On a TPC type whose derived types have tables it was refused (#101), and on an abstract TPC root it was 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
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.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 aNameClaim.Relation, and the name itself otherwise. The planner resolves a copy once to read its claims and again for the name.EnsureCreated()builds (On_the_root_of_TPC_each_table_refuses_its_own_overlapping_rows).Found on the way:
Namegives every copy one name. That is refused asSK1001, 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.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.
Tests
Offline: 757 (kernel), 195 (PostgreSQL package), 87 (second provider). Live: 4 and 74 on PostgreSQL 16 and on 18, 86 on SQL Server 2022. The consumer smoke test: 47 rows.
Nine rules were changed in turn and a test failed for each:
A_constraint_on_a_type_of_TPC_is_in_every_table_of_the_hierarchy_below_it, the live testThe_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_refusedA_name_that_is_taken_within_its_table_is_every_copys_nameA_copy_follows_the_rename_of_its_tableA_declaration_on_a_type_without_a_table_is_refused, added after the first run showed nothing held itNot here: the 5.x reader and its fixture (slice 2), entity splitting and the TPT refusal (slice 3), the path of #85.
🤖 Generated with Claude Code