Re: pg_restore: All GRANTs on table fail when any one role is missing - Mailing list pgsql-bugs

From Tom Lane
Subject Re: pg_restore: All GRANTs on table fail when any one role is missing
Date
Msg-id 12529.1531433262@sss.pgh.pa.us
Whole thread Raw
In response to pg_restore: All GRANTs on table fail when any one role is missing  (Moshe Jacobson <moshe@neadwerx.com>)
Responses Re: pg_restore: All GRANTs on table fail when any one role is missing  (Moshe Jacobson <moshe@neadwerx.com>)
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: Moshe Jacobson
Date:
Subject: pg_restore: All GRANTs on table fail when any one role is missing
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #15263: pg_dump / psql failure. When loading, psql does notsee function-based constraints or indices