Re: pg_get_object_address reports a published relation as non-existent

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Manuel Reyes Bravo <manuelreyesbravo(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: pg_get_object_address reports a published relation as non-existent
Date: 2026-09-17 22:50:47
Message-ID: CAHut+PvaBVJtMRE_i_jQH+9_wqHbwWtoiM8qp6ys0d7kD4FZQA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 18, 2026 at 12:57 AM Álvaro Herrera <alvherre(at)kurilemu(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2026-09-17 22:57:58 Re: WAIT FOR command should do some query jumbling
Previous Message Tristan Partin 2026-09-17 22:46:19 Re: Add ASCII fast path to Unicode normalization functions