Skip to content

Support for PostgreSQL 18#83

Open
ashenBlade wants to merge 2 commits intoenova:masterfrom
ashenBlade:master
Open

Support for PostgreSQL 18#83
ashenBlade wants to merge 2 commits intoenova:masterfrom
ashenBlade:master

Conversation

@ashenBlade
Copy link

@ashenBlade ashenBlade commented Nov 18, 2025

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.

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.
@ashenBlade ashenBlade changed the title Fix foreign keys for tables in different schemas unhandled Support for PostgreSQL 18 Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant