Re: Distinguish publication exclusions in object addresses

From: Manu <manuelreyesbravo(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Distinguish publication exclusions in object addresses
Date: 2026-09-22 23:32:27
Message-ID: 179011994715.485930.9380133175707344860@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit,

> Thanks for sharing the testcase patch but I don't find compelling to
> add it along with current patch due to: (a) it is not necessary to use
> temp table to test this patch, (b) I am not sure we want to test all
> negative cases especially with some special handling though I am open
> to consider it separately as a test to increase code-coverage.

Fair enough on both counts, and (a) was right: the temporary table was
incidental to that patch. Here it is as the separate coverage patch you
were open to, and with a reason to exist that does not depend on the
quoting fix.

check_publication_add_relation() can report

cannot specify relation "%s" in the publication EXCEPT clause

from six different ereport() sites: a partition with an incomplete
detach, an individual partition, an unsupported relkind, a system
table, a conflict log table, and a temporary or unlogged relation.

Of those six, the regression tests currently reach one. Grepping the
expected output for that message finds a single DETAIL:

DETAIL: This operation is not supported for individual partitions.

The attached patch covers three more, all in publication.sql next to
the existing non-EXCEPT cases for the same relations:

view -> not supported for views.
system table -> not supported for system tables.
temp table -> not supported for temporary tables.

(the DETAIL of each, verbatim: "This operation is ...")

The first two are plain statements. The temporary one prints the
message with the schema number redacted, because pg_temp_N depends on
the backend; stats_ext.sql already does this. I ran the same block from
three concurrent sessions, which got pg_temp_1, pg_temp_2 and pg_temp_3,
and all three printed the identical line.

make check passes, 239/239.

I left the two paths I could not reach cheaply: the incomplete-detach
case needs an interrupted concurrent detach, and the conflict log table
case needs that namespace to exist. Happy to drop any of the three if
you would rather keep publication.sql shorter - the system table and
view cases are the ones that cost nothing.

Regards,
Manu

Attachment Content-Type Size
0001-Add-test-coverage-for-the-publication-EXCEPT-clause-.patch text/plain 4.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-09-22 23:35:19 Re: [PATCH] Release replication slot on error in SQL-callable slot functions
Previous Message Manu 2026-09-22 23:29:44 Re: Add REPACK progress phases for logical decoding setup