Re: Distinguish publication exclusions in object addresses - Mailing list pgsql-hackers

From Chao Li
Subject Re: Distinguish publication exclusions in object addresses
Date
Msg-id 29B7A689-0E30-4A2B-A324-3390D70F93A9@gmail.com
Whole thread
In response to Re: Distinguish publication exclusions in object addresses  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Distinguish publication exclusions in object addresses
Re: Distinguish publication exclusions in object addresses
List pgsql-hackers

> On Sep 16, 2026, at 13:50, Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> --
> With Regards,
> Amit Kapila.
> <v4-0001-Distinguish-publication-exclusions-in-object-addr.patch>

V4 overall looks sold to me. Just a couple of small comments:

1
```
-- No entry of either kind.  testpub_default publishes nothing.
SELECT pg_get_object_address('publication excluded relation',
                             '{public, testpub_tbl1}', '{testpub_default}');
ERROR:  publication relation "testpub_tbl1" in publication "testpub_default" does not exist
```

For this new test, the error message is a little surprising to me. Since the requested object type is "publication
excludedrelation", I would expect the error message to say something like: 
```
publication excluded relation "testpub_tbl1" in publication "testpub_default" does not exist
```

2
```
+    if (objtype == OBJECT_PUBLICATION_EXCLUDED_REL && !isexcept)
+        ereport(ERROR,
+                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+                 errmsg("\"%s\" is not an excluded relation of publication \"%s\"",
+                        RelationGetRelationName(relation), pubname)));
+    else if (objtype == OBJECT_PUBLICATION_REL && isexcept)
+        ereport(ERROR,
+                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+                 errmsg("\"%s\" is not a published relation of publication \"%s\"",
+                        RelationGetRelationName(relation), pubname)));
```

Nitpick: with the modern ereport() style, the extra parentheses around errcode() and errmsg() are no longer needed.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: [PATCH] Release replication slot on error in SQL-callable slot functions
Next
From: solai v
Date:
Subject: Re: [PATCH] Add CANONICAL option to xmlserialize