← all rules

drop-constraint

warning

DROP CONSTRAINT

Why it's unsafe

DROP CONSTRAINT removes an integrity guarantee (foreign key, check, or unique) that application code may rely on; dropping a primary key or unique constraint can also break logical-replication replica identity.

Safe rewrite

Confirm no application logic or replication setup depends on the constraint before dropping it.

Example

Try it in the playground →

Unsafe

ALTER TABLE orders DROP CONSTRAINT fk_customer;

Related