v3-0002-Fix-publication-duplication-in-table-decription.patch

text/x-patch

Filename: v3-0002-Fix-publication-duplication-in-table-decription.patch
Type: text/x-patch
Part: 1
Message: Re: PSQL - prevent describe listing tables that are already in listed schemas

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v3-0002
Subject: Fix publication duplication in table decription
File+
src/bin/psql/describe.c 6 1
From d1536e616ce07c27cfb32a09eac46bae600f1d68 Mon Sep 17 00:00:00 2001
From: Jim Jones <jim.jones@uni-muenster.de>
Date: Tue, 19 May 2026 14:00:48 +0200
Subject: [PATCH v3 2/2] Fix publication duplication in table decription

---
 src/bin/psql/describe.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index f5551896598..7baf65ab664 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -3199,7 +3199,12 @@ describeOneTableDetails(const char *schemaname,
 								  "FROM pg_catalog.pg_publication p\n"
 								  "     JOIN pg_catalog.pg_publication_rel pr ON p.oid = pr.prpubid\n"
 								  "     JOIN pg_catalog.pg_class c ON c.oid = pr.prrelid\n"
-								  "WHERE pr.prrelid = '%s'\n",
+								  "WHERE pr.prrelid = '%s'\n"
+								  "  AND NOT EXISTS (\n"
+								  "     SELECT 1\n"
+								  "     FROM pg_catalog.pg_publication_namespace pn\n"
+								  "     WHERE pn.pnpubid = p.oid\n"
+								  "       AND pn.pnnspid = c.relnamespace)\n",
 								  oid, oid, oid);
 
 				if (pset.sversion >= 190000)
-- 
2.54.0