pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: pg_restore 12 "permission denied for schema" errors
Date: Thu, 20 Oct 2022 08:02:37 -0700
Message-ID: <ef3ae37b-cab0-7929-e695-e9711685766e@aklaver.com> (raw)
In-Reply-To: <d073e1ec-86f4-19c7-206e-c76ad9792bdc@gmail.com>
References: <287717df-88e2-a4a5-2025-260c39662bca@gmail.com>
	<40fd91d2-d981-2f44-4d58-a3f08a9448fb@familie-gard.de>
	<2980993.1666242738@sss.pgh.pa.us>
	<d073e1ec-86f4-19c7-206e-c76ad9792bdc@gmail.com>

On 10/20/22 06:20, Ron wrote:
> On 10/20/22 00:12, Tom Lane wrote:
>> Frank Gard <frank.von.postgresql.org@familie-gard.de> writes:
>>> Am 20.10.22 um 02:58 schrieb Ron:
>>>> pg_restore -v --create --clean --jobs=`nproc` -Fd --dbname=template1 
>>>> $DB
>>> What database do you want to restore your data into? As far as I know 
>>> your pg_restore command would import the data into template1, right?
>> No --- my ears went up about that too, but he's using --create.
>> So template1 is just the springboard for the initial connection
>> in which CREATE DATABASE will be issued.
>>
>> My guess is that there's something inconsistent between source
>> and target installations about roles and role-privilege grants.
>> We don't have enough details to do more than guess, though.
> 
> I ran "pg_dumpall --globals-only --no-role-passwords" on the source 
> instance, and applied it to the new instance before doing the 
> pg_restore. If I hadn't done that, pg_restore would have thrown errors 
> on all the GRANT and ALTER TABLE ... OWNER TO statements embedded in the 
> backup.
> 

Some questions:

1) The backup was from a Postgres 12.x database using a version 12 or 
higher instance of pg_backup?

2) What does nproc --jobs=`nproc` resolve to?

3) What if you run without --jobs?

4) What user are you running the pg_restore as?

5) Why the --no-role-passwords in the pg_dump?

-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (17+ messages)  latest in thread

Message-ID: <ef3ae37b-cab0-7929-e695-e9711685766e@aklaver.com>
Permalink:  ../ef3ae37b-cab0-7929-e695-e9711685766e@aklaver.com/
Also on:    postgresql.org/message-id/ef3ae37b-cab0-7929-e695-e9711685766e@aklaver.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, ronljohnsonjr@gmail.com
  Subject: Re: pg_restore 12 "permission denied for schema" errors
  In-Reply-To: <ef3ae37b-cab0-7929-e695-e9711685766e@aklaver.com>
  References: <287717df-88e2-a4a5-2025-260c39662bca@gmail.com> <40fd91d2-d981-2f44-4d58-a3f08a9448fb@familie-gard.de> <2980993.1666242738@sss.pgh.pa.us> <d073e1ec-86f4-19c7-206e-c76ad9792bdc@gmail.com> <ef3ae37b-cab0-7929-e695-e9711685766e@aklaver.com>

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

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