public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Tom Lane <[email protected]>
To: Rachel Roch <[email protected]>
Cc: Pgsql General <[email protected]>
Subject: Re: pg_restore ERROR: permission denied to change default privileges
Date: Fri, 13 Jun 2025 12:13:09 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

On 6/13/25 11:23, Tom Lane wrote:
> Rachel Roch <[email protected]> writes:
>> 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";
> 
> Well, you aren't going to be able to do that if you're not superuser.
> 
> You could undo that ALTER in the source database and re-make the dump,
> or edit the dump script to remove this command, or not use

To get at an editable script you can do something like:

pg_restore -f my_database_txt.sql  my_database.dump

This will give you a plain text version of the dump that you can feed 
back to psql to load into remote database.

If you want to do this in steps you can do:

pg_restore -s-f my_database_sch_txt.sql  my_database.dump

to get the object(schema) definitions only and then

pg_restore -a -f my_database_data_txt.sql  my_database.dump

to get the data definitions.

> pg_restore's "-1" switch and just ignore this error.
> 
> 			regards, tom lane
> 
> 

-- 
Adrian Klaver
[email protected]







view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pg_restore ERROR: permission denied to change default privileges
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox