pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve
Date: 2025-09-16 07:50:52
Message-ID: E1uyQSh-000y1w-2y@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Previously, pg_dump incorrectly queried pg_seclabel to retrieve security labels
for subscriptions, which are stored in pg_shseclabel as they are global objects.
This could result in security labels for subscriptions not being dumped.

This commit fixes the issue by updating pg_dump to query the pg_seclabels view,
which aggregates entries from both pg_seclabel and pg_shseclabel.
While querying pg_shseclabel directly for subscriptions was an alternative,
using pg_seclabels is simpler and sufficient.

In addition, pg_dump is updated to dump security labels on event triggers,
which were previously omitted.

Backpatch to all supported versions.

Author: Jian He <jian(dot)universality(at)gmail(dot)com>
Co-authored-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/CACJufxHCt00pR9h51AVu6+yPD5J7JQn=7dQXxqacj0XyDhc-fA@mail.gmail.com
Backpatch-through: 13

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/295c0a644af5c32e5310c5523cac0ccec64115e5

Modified Files
--------------
src/bin/pg_dump/pg_backup_archiver.c | 12 +++++++-----
src/bin/pg_dump/pg_dump.c | 7 ++++++-
2 files changed, 13 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2025-09-16 07:51:11 pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve
Previous Message Fujii Masao 2025-09-16 07:50:38 pgsql: pg_dump: Fix dumping of security labels on subscriptions and eve