Skip to content

Landing function, slice 2: a 5.x snapshot with an exclusion constraint on a TPC root is read #189

Done

Description

@CaffeinatedCoder

2026-11-25: in PR #190 (feat/189-legacy-tpc). Offline: 757 of the kernel's tests, 198 of the PostgreSQL package's, 87 of the second provider's. Live: 4 and 75 on PostgreSQL 16 and on 18, 86 on SQL Server 2022, the consumer smoke test's 47 rows.

What is there:

  • The fixture has ScaffoldedTpc: what the published 5.6.0 scaffolded for two TPC hierarchies (Generator/Tpc.cs), a root with a table of its own with a constraint under a name and one under the default name, and an abstract root with a constraint under a name. Eight constraints in its migration. The two fixtures that were there came out of the script unchanged, and a second run changed no file.
  • 5.x's names for the copies are the ones the landing function gives (Landing function, slice 1: a declaration on a TPC type lands on every table of the hierarchy below it #187): ex_rental, ex_rental_boat_rentals, ex_rental_car_rentals; ex_permit_fishing_permits, ex_permit_parking_permits under the abstract root; EX_rentals_During, EX_boat_rentals_During, EX_car_rentals_During.
  • The reader reads a constraint on a TPC type with derived types when the snapshot's CustomIndex:RenderingVersion is 3 or more, and refuses it below that or without the annotation, with the message that says to update to 5.6, add a migration and apply it.
  • LegacyHandoverTests: the snapshot against the same model declared here is no operations, from the snapshot to the model and back, and against a model that declares nothing every copy is dropped under 5.x's name.
  • LegacyHandoverLiveTests: 5.x's migration applied as scaffolded leaves the eight constraints EnsureCreated() builds for the model declared here, on PostgreSQL 16 and 18, and a copy 5.x built refuses its table's overlapping rows.

Not measured: that 5.6 creates the copies for a project that scaffolded before 5.5.0. The refusal's message says so from 5.x's own documentation of DeclarationTables.

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

Changed Fails
An older snapshot's constraint is read too A_constraint_on_the_root_of_a_TPC_hierarchy_is_read_from_the_version_that_made_copies
A TPC type's constraint is refused whatever the version that, and the two offline handover tests
A snapshot without the version is taken for the newest A_constraint_on_the_root_of_a_TPC_hierarchy_is_read_from_the_version_that_made_copies
No copy's name gets the table the live handover, both offline handover tests, and #187's two
A copy's name gets the declaring type's name behind it the same five

Part of #118 (decided 2026-11-25). After #187.

Problem

The 5.x reader refuses an exclusion constraint on the root of a TPC hierarchy: 5.x gave every table of the hierarchy its copy from 5.5.0 on (rendering version 3), and a declaration here was resolved for one table. Since #187 a declaration lands on every table, with 5.x's names for the copies, so the refusal has no reason left for those snapshots. A project with such a constraint cannot move off 5.x.

Change

  • The reader reads the constraint of a TPC root in a snapshot of rendering version 3 or later. An older snapshot's constraint is on the root's table alone and stays refused, with a message that says to scaffold once with 5.6 first.
  • The fixture gains a TPC hierarchy with a constraint on its root, with a name and without one, scaffolded by the published 5.6.0.

Done when

LegacyHandoverTests diffs the fixture's snapshot against the same model declared here to nothing, both ways, and LegacyHandoverLiveTests applies 5.x's migration as scaffolded and finds the catalog EnsureCreated() builds for the model declared here, on PostgreSQL 16 and 18.

Activity

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions