Repository navigation
fix: a declaration on a derived type that shares its table is refused, where the migration leads - #86
Merged
Conversation
…, where the migration leads Closes #82. 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 #82
Problem
StayandHoldderive fromReservationin one table. An exclusion constraint declared onStaywas added to the table with nothing in it that says "stay", so two overlappingHoldrows were refused with 23P01. The migration applied, and the database refused writes the model allows. 5.x and EF Core's ownHasIndexbehave the same way.Change
Decided by the maintainer on 2026-11-12: refuse it. The planner refuses a declaration on an entity type that shares its table with a base type, naming the topmost such type to declare it on. It is a kernel rule, so it holds for every contributor.
What it costs
A column only the derived type has cannot be named from the base type, so an object on it cannot be declared while the two share a table. A test holds that as a fact, and #85 has the options.
Tests
426 kernel and 62 PostgreSQL tests without a server. No statement that reaches a server changed.
GetDifferencesand fromHasDifferences. Declared on the base type, and on a derived type with its own table, the object is created. A snapshot with the declaration on the derived type diffs to nothing against the base-type model, and its object can be dropped.Stay/Holdmodel of the issue is refused; onReservationthe create script has the constraint.Each guard shown to fail, in a scratch copy:
A_declaration_on_a_derived_type_that_shares_its_table_is_refused×3,A_constraint_on_a_derived_type_…_is_refusedA_snapshot_that_holds_one_is_read_and_moving_it_to_the_base_type_costs_nothing, the PostgreSQL test's last assertionOn_the_base_type_or_on_a_derived_type_with_a_table_of_its_own_it_is_declared🤖 Generated with Claude Code