pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Aditya D <dsaditya91@gmail.com>
Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: pg_restore -L reordering of the statements does not work
Date: Tue, 14 Nov 2023 17:40:02 -0500
Message-ID: <2537261.1700001602@sss.pgh.pa.us> (raw)
In-Reply-To: <20231114222743.x2c2r74ttgom2cfx@awork3.anarazel.de>
References: <CAEATte6vgZr6d2abZo9_wxTarwQP3TC_NLpCKTDzWW4E4OB9cw@mail.gmail.com>
	<1589825.1698431686@sss.pgh.pa.us>
	<20231114194933.ci3nxol3avtisyrs@awork3.anarazel.de>
	<2522830.1699994542@sss.pgh.pa.us>
	<20231114222743.x2c2r74ttgom2cfx@awork3.anarazel.de>

Andres Freund <andres@anarazel.de> writes:
> On 2023-11-14 15:42:22 -0500, Tom Lane wrote:
>> Moreover, reordering the GRANTs is no solution, because who promised that
>> the schema owner granted you any permissions?

> I'm not quite following - the schema is created in the dump, so the grant is
> part of it?

Yeah, but the GRANT will restore whatever permissions existed in the
source database.  If the restoring user isn't super, those permissions
don't necessarily grant him access.

>> I experimented with making the restoring user be a member with inherit
>> of the nosuper_N roles, and indeed I still see the failure above,
>> which makes me wonder if the ACL check is being done correctly for
>> that specific case.  The INHERIT bit ought to let it work.

> The check is for nosuper_2 to have permission on the schema

... no, it should be for the user executing the ALTER to have permission.

> ... and the check
> happens before the grant on the schema. For inherit to help, nosuper_2 would
> have to be granted membership to the presumably more privileged user doing the
> restore.

No, surely the other way?  Restoring user must be member of nosuper_2,
else the ALTER OWNER won't work either.

			regards, tom lane





view thread (14+ messages)  latest in thread

Message-ID: <2537261.1700001602@sss.pgh.pa.us>
Permalink:  ../2537261.1700001602@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2537261.1700001602@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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, dsaditya91@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: pg_restore -L reordering of the statements does not work
  In-Reply-To: <2537261.1700001602@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