pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Moshe Jacobson <moshe@neadwerx.com>
Cc: Postgres-Bugs <pgsql-bugs@postgresql.org>
Subject: Re: pg_restore: All GRANTs on table fail when any one role is missing
Date: Thu, 12 Jul 2018 18:07:42 -0400
Message-ID: <12529.1531433262@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJ4CxLn9EUTdqd3S9+n+HZxwNuE8vXOnAV+hOZv5M6WX7ovdeA@mail.gmail.com>
References: <CAJ4CxLn9EUTdqd3S9+n+HZxwNuE8vXOnAV+hOZv5M6WX7ovdeA@mail.gmail.com>

Moshe Jacobson <moshe@neadwerx.com> writes:
> I take a backup using pg_dump -Fc, and then restore on the second cluster
> (where "user1" does not exist).
> The restore process says it ignored the error for the missing user, but the
> restored table now has no perms at all. Not even for user public.
> Examining pg_restore sql output shows two separate grant commands, however
> the problem persists even if I pipe pg_restore output into psql. Very
> strange.

Hm.  I can understand why this would happen if you do pg_restore direct to
the server: the GRANTs will all be part of the same "TOC entry" in the
dump file, and I'm pretty sure pg_restore issues the entire contents of
a TOC entry in one PQexec, so that it's effectively a single transaction.
However, if you tell pg_restore to emit text and then pass the text to
psql, each SQL command should be processed separately.  Are you sure about
the failure still occurring in that case?

			regards, tom lane




view thread (7+ messages)  latest in thread

Message-ID: <12529.1531433262@sss.pgh.pa.us>
Permalink:  ../12529.1531433262@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12529.1531433262@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, moshe@neadwerx.com
  Subject: Re: pg_restore: All GRANTs on table fail when any one role is missing
  In-Reply-To: <12529.1531433262@sss.pgh.pa.us>
  References: <CAJ4CxLn9EUTdqd3S9+n+HZxwNuE8vXOnAV+hOZv5M6WX7ovdeA@mail.gmail.com> <12529.1531433262@sss.pgh.pa.us>

* 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