Skip to content

Landing function, slice 3: a declaration on a split entity lands on the table that holds its columns, and a derived TPT type's inherited column is refused by name #191

Done

Description

@CaffeinatedCoder

2026-11-25: in PR #192 (feat/191-split-landings). Offline: 763 of the kernel's tests, 199 of the PostgreSQL package's, 87 of the second provider's. Live: 4 and 76 on PostgreSQL 16 and on 18, 86 on SQL Server 2022, the consumer smoke test's 47 rows.

What is there:

  • 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.

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.

With this slice #118's three are built. #85's path is its own issue.


Part of #118 (decided 2026-11-25). After #187 and #189; the last slice.

Problem

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

Change

  • A declaration on a split entity lands on the one table that has a column for every path it reads. Columns in more than one table: refused. Hand-written SQL where more than one table would do: refused, since nothing says which table the SQL means. Key columns alone, which every table has: the first table.
  • A derived TPT type reading an inherited column is refused with the base type named.
  • The same on a model and on its snapshot.

Done when

The planner's tests hold each row on a model and its compiled snapshot, and a live test on PostgreSQL shows a constraint on the second table of a split entity refusing the row it forbids.

Activity

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions