Re: pg_get_object_address reports a published relation as non-existent - Mailing list pgsql-hackers

From Peter Smith
Subject Re: pg_get_object_address reports a published relation as non-existent
Date
Msg-id CAHut+PvaBVJtMRE_i_jQH+9_wqHbwWtoiM8qp6ys0d7kD4FZQA@mail.gmail.com
Whole thread
In response to Re: pg_get_object_address reports a published relation as non-existent  (Álvaro Herrera <alvherre@kurilemu.de>)
List pgsql-hackers
On Fri, Sep 18, 2026 at 12:57 AM Álvaro Herrera <alvherre@kurilemu.de> wrote:
>
> On 2026-Sep-17, Manuel Reyes Bravo wrote:
>
> > The case
> > --------
> >
> >     CREATE TABLE t1(a int);
> >     CREATE PUBLICATION pub FOR ALL TABLES;
> >
> >     SELECT schemaname, tablename FROM pg_publication_tables
> >      WHERE pubname = 'pub';
> >      schemaname | tablename
> >     ------------+-----------
> >      public     | t1
> >
> >     SELECT pg_get_object_address('publication relation','{public,t1}','{pub}');
> >     ERROR:  publication relation "t1" in publication "pub" does not exist
>
> I'm not sure this is a valid complaint.  pg_publication_tables is a
> user-friendly view, so there's no reason for pg_get_object_address() to
> react to values obtained from there, I think.
>

My original post [1] was not comparing to the view
pg_publication_tables, or expecting anything to work. It was simply an
observation that the pg_get_object_address() ERROR message was
misleading by saying the relation is not a member of a publication,
when clearly it is.

e.g.
pg_get_object_address('publication relation','{public,t1}','{pub}');
ERROR:  publication relation "t1" in publication "pub" does not exist

vs.

\d+ public.t1
                                           Table "public.t1"
 Column |  Type   | Collation | Nullable | Default | Storage |
Compression | Stats target | Description
--------+---------+-----------+----------+---------+---------+-------------+--------------+-------------
 a      | integer |           |          |         | plain   |
    |              |
Included in publications:
    "pub"
Access method: heap

~~~

So, I'd imagined a trivial fix to give more context for the message, like:
ERROR:  publication relation "t1" in publication "pub" does not exist
in system catalog "pg_publication_rel".

(If it is not permitted for messages to expose system catalog names
like that, then some other minor rewording of the original error would
be OK too ).

======
[1] https://www.postgresql.org/message-id/CAHut%2BPvbNtMyWYyH7XO3MP%3DFwTfG%3DYyyDJTgrs9rd1fePqQ-Zw%40mail.gmail.com

Kind Regards,
Peter Smith.
Fujitsu Australia



pgsql-hackers by date:

Previous
From: "Tristan Partin"
Date:
Subject: Re: Add ASCII fast path to Unicode normalization functions
Next
From: Alexander Korotkov
Date:
Subject: Re: WAIT FOR command should do some query jumbling