| From: | Dilip Kumar <dilipbalaut(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Replace is_publishable_class() with relispublishable column in pg_class |
| Date: | 2025-12-16 15:49:21 |
| Message-ID: | CAFiTN-uM3WLZ7taHr8U35d+sxcOaT8d4KoXdHhhAjomQ5-B1LA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hello hackers,
I would like to propose an improvement to the way PostgreSQL
determines if a relation is eligible for logical replication.
Currently, this check is performed dynamically via
is_publishable_class(), which relies on hard-coded OID checks and
relkind. As noted in the existing comments atop
is_publishable_class[1], the long-term solution is to add a boolean
column to pg_class and depend on that instead of OID checks.
Motivation
========
1) The check is performed frequently in the logical decoding path
(e.g., in pgoutput_change and pgoutput_truncate). Moving this to a
cached catalog attribute in pg_class allows for a simple check.
2) As suggested by Amit Kpila [2], for the upcoming Conflict Log Table
feature, we need a clean way to exclude these internal conflict log
tables from publication. A catalog flag allows us to set this property
at relation creation rather than adding more special cases.
Proposed Changes
===============
The attached patch implements the following:
1) Catalog Update: Adds relispublishable (bool) to pg_class.
2) Creation Logic: Input parameter is added to
heap_create_with_catalog() so that caller can pass whether the
relation is publishable or not.
3) Update pgoutput and other relevant places to utilize the new
pg_class column directly.
[1]
The best
* long-term solution may be to add a "relispublishable" bool to pg_class,
* and depend on that instead of OID checks.
*/
static bool
is_publishable_class(Oid relid, Form_pg_class reltuple)
{
..
}
--
Regards,
Dilip Kumar
Google
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Add-relispublishable-column-to-pg_class-catalog.patch | application/octet-stream | 11.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Melanie Plageman | 2025-12-16 16:05:56 | Re: Fix uninitialized PruneFreezeResult in pruneheap and vacuumlazy |
| Previous Message | Andres Freund | 2025-12-16 15:39:15 | Re: relfilenode statistics |