Open
Conversation
During DROP extension tracks which objects are dropped and tries not to combine objects from different schemas. If such situation is detected, then such DDL is marked unhandled with reason 'mixed_objects'. But starting from PostgreSQL 18 triggers have their own schemas in records returned from `pg_event_trigger_dropped_objects()`. When we have foreign keys that points to table in another schema, then such check will fail. This patch adds check for triggers on foreign keys - for them special triggers are created, named 'RI_ConstraintTrigger_XXX'. So we just have to filter out dropped triggers named in such way. Also, check 'NOT original' is added to this check to find situations where user explicitly asked to drop this constraint.
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.
This PR has 2 commits, that fixing different aspects.
Foreign key on table in different schema
During DROP extension tracks which objects are dropped and tries not to combine objects from different schemas. If such situation is detected, then such DDL is marked unhandled with reason 'mixed_objects'.
But starting from PostgreSQL 18 triggers have their own schemas in records returned from
pg_event_trigger_dropped_objects(). When we have foreign keys that points to table in another schema, then such check will fail.This patch adds check for triggers on foreign keys - for them special triggers are created, named 'RI_ConstraintTrigger_XXX'. So we just have to filter out dropped triggers named in such way.
Also, check 'NOT original' is added to this check to find situations where user explicitly asked to drop this constraint.
New ALTER TABLE type
In PG 18 AT_CheckNotNull moved to pg_constraint.
Also, added new cmd subtype - AT_SetExpression.
This is all in C code.