Autodesk / pgbelt

Pgbelt is a CLI tool used to manage Postgres data migrations from beginning to end, for a single database or a fleet, leveraging pglogical replication.
Apache License 2.0
18 stars 5 forks source link

Cleanup command fails to drop pglogical role due to privileges on view `pg_stat_statements` #83

Open vjeeva opened 2 years ago

vjeeva commented 2 years ago

Describe the bug PgBelt fails to drop the pglogical role when running belt teardown --full with the following error:

ERROR:  role "pglogical" cannot be dropped because some objects depend on it
DETAIL:  privileges for view pg_stat_statements

Expected behavior The teardown command runs without errors and doesn't stop in the middle.

Additional context This happened with a Postgres 12 RDS database.

vjeeva commented 2 years ago

Solution - just gotta run an extra REVOKE to get rid of the blocker:

REVOKE ALL ON pg_stat_statements FROM pglogical;