pg_restore ERROR: permission denied to change default privileges

From: Rachel Roch <rroch(at)tutanota(dot)de>
To: Pgsql General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: pg_restore ERROR: permission denied to change default privileges
Date: 2025-06-13 18:08:11
Message-ID: OSeT_Gx--F-9@tutanota.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a pg_dump from a postgres instance that I am attempting to restore onto a cloud one (i.e. an instance where I don't have access to the postgres superuser)

The dump was taken with:

pg_dump -Fc --quote-all-identifiers --serializable-deferrable --no-unlogged-table-data my_database > my_database.dump

I am attempting to restore it using the proxy admin user provided by the cloud provider:

pg_restore -d "host=foobar.example.com port=12345 user=my_cloud_admin_user sslrootcert=/path/to/the/cert.crt sslmode=require dbname=my_database" -O -1 my_database.dump

This is the error I am seeing:
pg_restore: error: could not execute query: ERROR:  permission denied to change default privilegesCommand was: ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT SELECT ON TABLES TO "my_database_ro";

N.B. "my_database_ro" being a user that was on the original database, and was successfully created in the new database by restoring a "pg_dumpall --globals-only" into the new database before attempting the pg_restore

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2025-06-13 18:23:07 Re: pg_restore ERROR: permission denied to change default privileges
Previous Message Ron Johnson 2025-06-12 13:29:48 Re: db maintanance problem VACUUM FULL