Modifying pg_dump To Exclude Event Triggers
At $WORK
, we have a case where we have implemented an event trigger to prevent customers from dropping an extension. As this extension is part of contrib
and normally installed by users, we can’t prevent them from dropping it normally. However, event triggers can only be created by superusers, so a pg_dump
of the database creates a dump that can’t be restored by a non-superuser. To solve this, lets implement a custom pg_dump
that optionally excludes event triggers.
You can see the following implementation in this diff on my fork of the Postgres repository.