From: Tom Lane <tgl@sss.pgh.pa.us>
To: 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: Fri, 27 Oct 2023 14:34:46 -0400
Message-ID: <1589825.1698431686@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEATte6vgZr6d2abZo9_wxTarwQP3TC_NLpCKTDzWW4E4OB9cw@mail.gmail.com>
References: <CAEATte6vgZr6d2abZo9_wxTarwQP3TC_NLpCKTDzWW4E4OB9cw@mail.gmail.com>
Aditya D <dsaditya91@gmail.com> writes:
> Problem Statement - The ACL command i.e. The grant statement gets called
> out at the end while performing pg_restore and the use case is to call it
> at the beginning. I believe even though the re-ordering is done the
> statements are executed using the "Internal Archive Id" while referring
> to the dump file.
Yeah, see the comments for RestorePass:
* For historical reasons, ACL items are interspersed with everything else in
* a dump file's TOC; typically they're right after the object they're for.
* However, we need to restore data before ACLs, as otherwise a read-only
* table (ie one where the owner has revoked her own INSERT privilege) causes
* data restore failures. On the other hand, matview REFRESH commands should
* come out after ACLs, as otherwise non-superuser-owned matviews might not
* be able to execute. (If the permissions at the time of dumping would not
* allow a REFRESH, too bad; we won't fix that for you.) We also want event
* triggers to be restored after ACLs, so that they can't mess those up.
*
* These considerations force us to make three passes over the TOC,
* restoring the appropriate subset of items in each pass. We assume that
* the dependency sort resulted in an appropriate ordering of items within
* each subset.
Use of an -L switch overrides the dependency sort, but not this
pass mechanism.
Whatever you're hoping to do by overriding that is most likely
just going to replace one kind of breakage by another.
regards, tom lane
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, dsaditya91@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: pg_restore -L reordering of the statements does not work
In-Reply-To: <1589825.1698431686@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