Repository navigation
fix: a declaration on a type of TPC whose derived types have tables is refused - #131
Merged
Merged
Conversation
…s refused, not left on one table A declaration is resolved against one table. On the root of a TPC hierarchy, or on any type of one whose derived types have tables of their own, it reached that type's table alone: the derived types' tables got nothing, and nothing said so. EF Core gives an index declared on such a type to every table, and 5.x gave each a copy of an exclusion constraint. Until a declaration is carried to every table (#118), one on such a type is refused in the context's own model, naming the derived types that have tables. A root without a table is refused the same way. A type without derived types has one table, its own, and is declared on as before, on the columns it inherits too. A snapshot that holds such a declaration is read. Closes #101 Co-Authored-By: Claude Fable 5.2 <[email protected]>
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 #101
Problem
Reservationis the concrete root of a TPC hierarchy, withStayandHoldin tables of their own.DeclarePostgresonReservationgave:Nothing for
staysandholds, and no error: overlapping rows in either were accepted. EF Core gives an index declared on such a type to every table of the hierarchy, and 5.x gave each a copy of an exclusion constraint, so a consumer expects the same. An abstract root was refused already, for having no table; the 5.x reader refuses a root with derived types. A declaration written here on a type that has a table was the case that passed.It is #82 the other way round: there a declaration on a derived type reached a table it shares, here one on a base type misses the tables below it. Both follow from a declaration being resolved against one table.
Change
SchemaOperationPlanner.TablesBelow). The message names those types and One landing function: the tables a declaration lands on, total over the mapping strategies #118, and says where to declare instead: on each type that has no derived types, under a name of its own.CLAUDE.mdholds it beside An exclusion constraint declared on a derived type of a shared table covers its siblings' rows #82's.Tests
Locally, after a rebase onto
mainwith #103, #110 and #124 in it: 622 kernel tests, 198 of the PostgreSQL package with the live ones on PostgreSQL 16 and 18, 125 probes.SchemaOperationPlannerTests, on Npgsql, SQL Server and SQLite with the sample contributor: refused on an abstract root (namingCar, Truck, Roadster), on a type with a table and a derived type (namingRoadster), and on a root above an abstract type (namingCaravanalone), also byHasDifferences; declared on two types without derived types, each index in its own table on the inherited column; a snapshot that holds a declaration on such a type is read where a diff starts and where one ends.PgExclusionMigrationTests: the model of the issue is refused; the constraint onStayis one statement forstays.PgExclusionLiveTests: that constraint applied on PostgreSQL 16 and 18, with the catalogEnsureCreated()builds.Guards shown to fail, four defects seeded one at a time in a scratch copy:
Roadster)Trailer)Decisions in this PR that are not confirmed
Not in this PR
The 5.x reader's own refusal of a TPC root stays as it is: it goes with #118, when a 5.x snapshot of such a hierarchy can be matched.
🤖 Generated with Claude Code