DROP RULE is a DDL command for removing a rule.
DROP RULE has always been present in PostgreSQL, although it only became properly functional from PostgreSQL 6.4.
Basic usage example for
postgres=# DROP RULE foo_insert_rule ON foo; DROP RULE
Attempting to drop a non-existent rule:
postgres=# DROP RULE foo_update_rule ON foo; ERROR: rule "foo_update_rule" for relation "foo" does not exist
Safely attempting to drop a rule which might not exist:
postgres=# DROP RULE IF EXISTS foo_insert_rule ON foo; NOTICE: rule "foo_insert_rule" for relation "foo" does not exist, skipping DROP RULE