Re: Distinguish publication exclusions in object addresses

From: Peter Smith <smithpb2250(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>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Distinguish publication exclusions in object addresses
Date: 2026-09-16 07:15:40
Message-ID: CAHut+PvbNtMyWYyH7XO3MP=FwTfG=YyyDJTgrs9rd1fePqQ-Zw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 16, 2026 at 3:51 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> > 4.
> > + if (isexcept)
> > + ereport(ERROR,
> > + (errcode(ERRCODE_WRONG_OBJECT_TYPE),
> > + errmsg("\"%s\" is not a published relation of publication \"%s\"",
> > + RelationGetRelationName(relation), pubname)));
> > + else
> > + ereport(ERROR,
> > + (errcode(ERRCODE_WRONG_OBJECT_TYPE),
> > + errmsg("\"%s\" is not an excluded relation of publication \"%s\"",
> > + RelationGetRelationName(relation), pubname)));
> >
> > Publications can have the same table name in multiple schemas. The
> > name should be fully-qualified in the errmsg to eliminate any
> > ambiguity.
> >
>
> But I don't see any ambiguity here as the user can only pass one
> relation name. Also, we use the unqualified name in nearby message
> [1]. We use RelationGetRelationName all over the code in the error
> messages and I don't see the need to qualify here. We will simply
> return the name the user has passed.
>

In this experiment below I got an unexpected result.
- Is it a bug?
- Is it somehow reporting about a "t1" table of another schema?
- Did I type something wrong somewhere?

I cannot tell because the table name was not qualified...

CREATE SCHEMA s1;
CREATE SCHEMA s2;
CREATE SCHEMA s3;

CREATE TABLE t1(a int);
CREATE TABLE s1.t1(a int);
CREATE TABLE s2.t1(a int);
CREATE TABLE s3.t1(a int);

CREATE PUBLICATION pub FOR ALL TABLES EXCEPT (TABLE s2.t1, s3.t1);

SELECT pg_get_object_address('publication relation','{public,t1}','{pub}');
2026-09-16 17:06:17.136 AEST [250078] ERROR: publication relation
"t1" in publication "pub" does not exist
2026-09-16 17:06:17.136 AEST [250078] STATEMENT: SELECT
pg_get_object_address('publication relation','{public,t1}','{pub}');
ERROR: publication relation "t1" in publication "pub" does not exist

That message can't be right because....

\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

======
Kind Regards,
Peter Smith
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Osama Abdul Qader 2026-09-16 07:27:54 Re: Severe performance degradation with concurrent updates due to excessive EvalPlanQual (EPQ) re‑evaluation
Previous Message Richard Guo 2026-09-16 07:02:02 Re: remove_useless_joins vs. bug #19560