pg_dump: Fix dumping of security labels on subscriptions and event triggers.
authorFujii Masao <fujii@postgresql.org>
Tue, 16 Sep 2025 07:44:58 +0000 (16:44 +0900)
committerFujii Masao <fujii@postgresql.org>
Tue, 16 Sep 2025 07:46:58 +0000 (16:46 +0900)
commit295c0a644af5c32e5310c5523cac0ccec64115e5
tree27fbac5b4fadf40cdd44a4994e0d5ed097150654
parentdb900ec358bd0ffa59b60a906f2ddc5305bc6b8b
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.universality@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CACJufxHCt00pR9h51AVu6+yPD5J7JQn=7dQXxqacj0XyDhc-fA@mail.gmail.com
Backpatch-through: 13
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c