From 62055ddac9cf73def22227e9d3af275f58180707 Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Thu, 3 Jul 2025 11:18:06 +0800
Subject: [PATCH v2 2/3] make pg_dump dump security label for shared database
 objects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

As noted in [1], SUBSCRIPTION and similar objects are treated as global objects.
Therefore, we should use pg_catalog.pg_seclabels in collectSecLabels instead of
pg_catalog.pg_seclabel.
The database’s own security label is handled via dumpDatabase, so this change
should be appropriate.

[1] https://www.postgresql.org/docs/devel/catalog-pg-shseclabel.html
discussion: https://postgr.es/m/CACJufxHCt00pR9h51AVu6+yPD5J7JQn=7dQXxqacj0XyDhc-fA@mail.gmail.com
commitfest entry: https://commitfest.postgresql.org/
---
 src/bin/pg_dump/pg_dump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 1937997ea67..17cca2dd667 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -16476,7 +16476,7 @@ collectSecLabels(Archive *fout)
 
 	appendPQExpBufferStr(query,
 						 "SELECT label, provider, classoid, objoid, objsubid "
-						 "FROM pg_catalog.pg_seclabel "
+						 "FROM pg_catalog.pg_seclabels "
 						 "ORDER BY classoid, objoid, objsubid");
 
 	res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
-- 
2.34.1

