Example:
ALTER TABLE table_x
DROP CONSTRAINT table_x_table_y_column_fkey;
This acquires an AccessExclusiveLock on both table_x, and table_y.
Without inspecting the rest of the schema it's not possible to tell for sure this is a foreign key constraint, or what table it might be referencing.
We do know that Postgres' default constraint naming will always apply the _fkey%d label to the constraint name, and it will do this after truncating the constraint name to make sure there is room for the label
We could have this rule configured with a regex to match foreign key constraints names, and that could also provide a mechanism for configuring the rule if you're using non-default constraint naming.
That config could maybe also be coupled with a rule that enforces non-default constraint naming matches the appropriate pattern?
Example:
This acquires an
AccessExclusiveLockon bothtable_x, andtable_y.Without inspecting the rest of the schema it's not possible to tell for sure this is a foreign key constraint, or what table it might be referencing.
We do know that Postgres' default constraint naming will always apply the
_fkey%dlabel to the constraint name, and it will do this after truncating the constraint name to make sure there is room for the labelWe could have this rule configured with a regex to match foreign key constraints names, and that could also provide a mechanism for configuring the rule if you're using non-default constraint naming.
That config could maybe also be coupled with a rule that enforces non-default constraint naming matches the appropriate pattern?