Re: Support EXCEPT for ALL SEQUENCES publications

Zsolt Parragi <zsolt.parragi@percona.com>

From: Zsolt Parragi <zsolt.parragi@percona.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2026-05-27T21:51:59Z
Lists: pgsql-hackers
Hello!

+					if (footers[0] == NULL)
+						footers[0] = pg_strdup(tmpbuf.data);
+					else if (footers[1] == NULL)
+						footers[1] = pg_strdup(tmpbuf.data);
+					else
+						footers[2] = pg_strdup(tmpbuf.data);
+					resetPQExpBuffer(&tmpbuf);

Shouldn't the matching free calls also updated, this now leaks footers[2]?

+							  "\n AND NOT EXISTS (\n"
+							  "     SELECT 1\n"
+							  "     FROM pg_catalog.pg_publication_rel pr\n"
+							  "     WHERE pr.prpubid = p.oid AND\n"
+							  "     pr.prrelid = '%s')"

Isn't a pr.prexcept check missing from this? It is included in other queries.

-		/* EXCEPT clause is not supported with ALTER PUBLICATION */
-		Assert(exceptseqs == NIL);
-

Would it be worth it to keep a more restricted assert, saying that
EXCEPT clause is only supported for ALTER PUBLICATION ... SET?