| From: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Distinguish publication exclusions in object addresses |
| Date: | 2026-08-06 14:48:55 |
| Message-ID: | CAHGQGwHfESBexa7fq99EvFCf31av=O9h9udnw22ymxmm6LMZzw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
I'd like to propose the attached patch, which makes object address output
distinguish publication EXCEPT entries from ordinary publication table
mappings.
pg_publication_rel can now represent either an explicitly published table
or a table excluded from a FOR ALL TABLES publication. However,
the object address code currently treats every pg_publication_rel entry
as a publication relation.
For example,
=# CREATE TABLE t (a int);
=# CREATE PUBLICATION p FOR ALL TABLES EXCEPT (TABLE t);
=# SELECT pi.* FROM pg_publication_rel pp CROSS JOIN LATERAL
pg_identify_object('pg_publication_rel'::regclass, pp.oid, 0) AS pi;
type | schema | name | identity
----------------------+--------+--------+---------------------------
publication relation | (null) | (null) | public.t in publication p
=# SELECT pd.* FROM pg_publication_rel pp CROSS JOIN LATERAL
pg_describe_object('pg_publication_rel'::regclass, pp.oid, 0) AS pd;
pd
-----------------------------------------
publication of table t in publication p
Although the pg_publication_rel entry for t represents an exclusion,
the object address output makes it appear to be an ordinary published-table
mapping. This affects pg_identify_object(), pg_describe_object(),
and pg_identify_object_as_address(), and can also be confusing for tools
that use object addresses, such as audit or DDL deparsing tools.
The root cause is that objectaddress.c does not check
pg_publication_rel.prexcept when describing or identifying
pg_publication_rel objects.
The patch fixes this by distinguishing EXCEPT entries. They are now
reported as publication exclusion, with identities such as:
=# SELECT pi.* FROM pg_publication_rel pp CROSS JOIN LATERAL
pg_identify_object('pg_publication_rel'::regclass, pp.oid, 0) AS pi;
type | schema | name | identity
-----------------------+--------+--------+--------------------------------------
publication exclusion | (null) | (null) | public.t excluded from
publication p
=# SELECT pd.* FROM pg_publication_rel pp CROSS JOIN LATERAL
pg_describe_object('pg_publication_rel'::regclass, pp.oid, 0) AS pd;
pd
-----------------------------------------
exclusion of table t from publication p
Thoughts?
Regards,
--
Fujii Masao
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Distinguish-publication-exclusions-in-object-addr.patch | application/octet-stream | 13.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Langote | 2026-08-06 14:50:20 | InvalidateConstraintCacheCallBack() can free fpmeta while it's in use |
| Previous Message | Hannu Krosing | 2026-08-06 14:31:44 | Re: WAL compression setting after PostgreSQL LZ4 default change |