Re: pg_restore: All GRANTs on table fail when any one role is missing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Moshe Jacobson <moshe(at)neadwerx(dot)com>
Cc: Postgres-Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: pg_restore: All GRANTs on table fail when any one role is missing
Date: 2018-07-12 22:07:42
Message-ID: 12529.1531433262@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Moshe Jacobson <moshe(at)neadwerx(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2018-07-13 08:19:14 Re: BUG #15263: pg_dump / psql failure. When loading, psql does not see function-based constraints or indices
Previous Message Moshe Jacobson 2018-07-12 19:48:04 pg_restore: All GRANTs on table fail when any one role is missing