Skip to content

feat: a declaration on a split entity lands on the table that has its columns - #192

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
feat/191-split-landings
Nov 25, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
feat/191-split-landings

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #191

The last of three slices of #118, after #187 and #189.

Problem

  • An entity split over two tables (SplitToTable): a declaration was resolved against the type's first table, so one that reads a column of the second was refused as having no column.
  • A derived type with a table of its own (TPT) that reads a column it inherits: the refusal said only that the path has no column.

Change

  • A declaration on an entity split over tables is resolved in each of the tables (Landings.Fragments), and lands on the one where no path lacks a column. None: refused, with the tables named. More than one, which is a declaration over the key's columns alone: the first table; with SQL written by hand it is refused.
  • The resolver's refusal of a path without a column carries its path (MissingColumn) and stays the InvalidOperationException the contract says. Only that refusal is taken for "not this table": a path that names no property fails as itself.
  • A derived type with a table of its own that reads an inherited column is refused with the base type named.
  • The same on a model and on its compiled snapshot, on Npgsql, SQL Server and SQLite.
  • On PostgreSQL 16 and 18 a constraint on the second table of a split entity is in that table, as EnsureCreated() builds it, and refuses overlapping rows (On_a_split_entity_the_table_with_the_column_refuses_overlapping_rows).

On the way: the first form made the refusal a type of its own derived from InvalidOperationException, and A_property_with_no_column_in_the_table_is_refused failed, since it asserts the exact type. The full offline run showed it, not the tests I ran first.

Tests

Offline: 763 (kernel), 199 (PostgreSQL package), 87 (second provider). Live: 4 and 76 on PostgreSQL 16 and on 18, 86 on SQL Server 2022. The consumer smoke test: 47 rows.

Nine rules were changed in turn. A test failed for eight:

Changed Fails
A split entity is resolved in its first table A_declaration_on_a_split_entity_lands_on_the_table_that_has_its_columns on three providers, the refusal's test, both of the PostgreSQL package's
The fragments are the own table alone the same
The second table comes first the kernel's four, A_constraint_on_a_split_entity_is_in_the_table_that_has_its_columns
Hand-written SQL on a split entity is taken for the first table A_constraint_on_a_split_entity_is_in_the_table_that_has_its_columns
Columns of two tables fail without the tables named A_declaration_over_columns_of_two_tables_of_a_split_entity_is_refused, and the PostgreSQL package's
An inherited column is refused without the base type A_declaration_on_a_derived_type_that_reads_an_inherited_column_names_the_base_type
Any refusal is taken for a table without the column A_path_that_names_no_property_of_a_split_entity_fails_as_itself
The refusal does not carry its path five of the kernel's, both of the PostgreSQL package's

Not held by a test: InheritedFrom leaves out the declaring type when it is the entity type itself. It keeps the message from saying a type inherits from itself; no model I know reaches it, since a type's own property has a column in its own table.

🤖 Generated with Claude Code

… columns

An entity split over tables has its key's columns in each and every
other column in one. A declaration is resolved in each table and lands
on the one where no path lacks a column. None: refused, with the tables
named. More than one, a declaration over the key alone: the first; with
SQL written by hand it is refused, since nothing says which table the
SQL means.

The resolver's refusal of a path without a column carries its path, and
only that refusal is taken for "not this table". A derived type with a
table of its own that reads an inherited column is refused with the base
type named.

Closes #191

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 25, 2026
@CaffeinatedCoder CaffeinatedCoder added enhancement New feature or request package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring labels Nov 25, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit c6dfd42 into main Nov 25, 2026
10 of 11 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the feat/191-split-landings branch November 25, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring enhancement New feature or request package/core Affects CodoMetis.EFCore.SchemaKit (the kernel)

Projects

None yet

1 participant