Re: pg_restore --no-policies should not restore policies' comment

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-07-02T02:17:09Z
Lists: pgsql-hackers

Attachments

On Fri, Jun 27, 2025 at 1:34 PM Fujii Masao <masao.fujii@oss.nttdata.com> wrote:
>
> > To do that, we need
> > 1. we checked that COMMENTS on policies, the TocEntry->tag begins with
> > "POLICY". which is true, see above code walk through.
> > 2. We also need to make sure that no other dumpComment call results in a
> > COMMENT command whose TocEntry->tag also starts with "POLICY".
> > which is also true, per https://www.postgresql.org/docs/current/sql-comment.html
> > after "COMMENT ON", the next word is fixed, and "POLICY" only occurs once.
> >
> >
> > If this is what we want, we can do the same for
> > "--no-publications", "--no-subscriptions" too.
>
> Agreed.
>

hi.

I’ve tested the pg_restore options --no-policies, --no-publications, and
--no-subscriptions locally.
However, I haven’t tested --no-security-labels option, so no changes were
made for it.  Testing --no-security-labels appears to need more setup, which
didn’t seem trivial.

writing Perl tests is not easier for me, I didn’t add those either.
(seems in master, we didn't have --no-publications, --no-subscriptions
tests too)

Commits

  1. pg_dump: Remove unnecessary code for security labels on extensions.

  2. pg_restore: Fix security label handling with --no-publications/subscriptions.

  3. pg_dump: Fix dumping of security labels on subscriptions and event triggers.

  4. pg_restore: Fix comment handling with --no-policies.

  5. pg_restore: Fix comment handling with --no-publications / --no-subscriptions.

  6. Core support for "extensions", which are packages of SQL objects.