pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Haribabu Kommi <kommi.haribabu@gmail.com>
Cc: moshe@neadwerx.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: pg_restore: All GRANTs on table fail when any one role is missing
Date: Sat, 28 Jul 2018 13:21:11 -0400
Message-ID: <5680.1532798471@sss.pgh.pa.us> (raw)
In-Reply-To: <CAJrrPGcaF4uDdf_14FkUYGqcseU-5EyRXRLvsNWx3Yp9bvK=dQ@mail.gmail.com>
References: <CAJ4CxLn9EUTdqd3S9+n+HZxwNuE8vXOnAV+hOZv5M6WX7ovdeA@mail.gmail.com>
	<12529.1531433262@sss.pgh.pa.us>
	<CAJ4CxLnow=6MUWB_7gN5FQjj0ZdXHVad94zj94Sg2uVHHE1YkA@mail.gmail.com>
	<CAJ4CxLk5-jyO6=T=QpCN8JjhXDx00HSGF7aoxvoN-uUnFnG1WQ@mail.gmail.com>
	<CAJrrPGcaF4uDdf_14FkUYGqcseU-5EyRXRLvsNWx3Yp9bvK=dQ@mail.gmail.com>

Haribabu Kommi <kommi.haribabu@gmail.com> writes:
> On Tue, Jul 24, 2018 at 5:14 AM Moshe Jacobson <moshe@neadwerx.com> wrote:
>> On Tue, Jul 17, 2018 at 12:02 PM Moshe Jacobson <moshe@neadwerx.com>
>> wrote:
>>> Here is a reproduction of the problem exclusively on 10.4.

>> Can anyone validate this bug?

> I am not able to reproduce the issue.

I got around to trying this today, and I can't reproduce it either.
I get the expected behavior when running pg_restore's output through
psql --- all three commands execute, with the middle one failing:

...
REVOKE
ERROR:  role "user1" does not exist
GRANT

mzj_test=# \dp
                             Access privileges
 Schema |  Name  | Type  | Access privileges | Column privileges | Policies 
--------+--------+-------+-------------------+-------------------+----------
 public | table1 | table | =a/postgres       |                   | 
(1 row)

while if I try to run the pg_restore direct to database, all three
commands fail because they're implicitly grouped into one transaction:

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3058; 0 0 ACL TABLE table1 postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  role "user1" does not exist
    Command was: REVOKE ALL ON TABLE public.table1 FROM postgres;
GRANT INSERT ON TABLE public.table1 TO user1;
GRANT INSERT ON TABLE public.table1 TO PUBLIC;

WARNING: errors ignored on restore: 1

mzj_test=# \dp
                             Access privileges
 Schema |  Name  | Type  | Access privileges | Column privileges | Policies 
--------+--------+-------+-------------------+-------------------+----------
 public | table1 | table |                   |                   | 
(1 row)


The latter behavior is not great, probably, but it's acting as designed.

As for Moshe's different results when going through psql, the only
theory that comes to mind is that he's got it configured with
ON_ERROR_STOP turned on, probably in ~/.psqlrc.

			regards, tom lane




view thread (7+ messages)  latest in thread

Message-ID: <5680.1532798471@sss.pgh.pa.us>
Permalink:  ../5680.1532798471@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5680.1532798471@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, kommi.haribabu@gmail.com, moshe@neadwerx.com
  Subject: Re: pg_restore: All GRANTs on table fail when any one role is missing
  In-Reply-To: <5680.1532798471@sss.pgh.pa.us>
  References: <CAJ4CxLn9EUTdqd3S9+n+HZxwNuE8vXOnAV+hOZv5M6WX7ovdeA@mail.gmail.com> <12529.1531433262@sss.pgh.pa.us> <CAJ4CxLnow=6MUWB_7gN5FQjj0ZdXHVad94zj94Sg2uVHHE1YkA@mail.gmail.com> <CAJ4CxLk5-jyO6=T=QpCN8JjhXDx00HSGF7aoxvoN-uUnFnG1WQ@mail.gmail.com> <CAJrrPGcaF4uDdf_14FkUYGqcseU-5EyRXRLvsNWx3Yp9bvK=dQ@mail.gmail.com> <5680.1532798471@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