A new C function `get_partition_root`.

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: A new C function `get_partition_root`.
Date: 2026-07-17 04:10:44
Message-ID: CAHut+Ptc73UpWSn4teMyMxQoHwGJjRwhWiu=hGJqAj5k2AOXEw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This patch introduces a new C function `get_partition_root`.

WHY?

1. It is the C equivalent of the already-existing SQL function
`pg_partition_root`

2. Some code is not interested in the partition "ancestors", yet it
still had to declare/fetch/free an ancestors list to obtain the root
relid at llast_oid(ancestors).

3. The logical replication FOR TABLES IN SCHEMA EXCEPT (...) patches
[1] (still in development) have many more code fragments like this
where the logic wants only the partition root OID -- This function
would simplify all those.

~~~

PSA v1

Passes make check-world.

Thoughts?

======
[1] https://www.postgresql.org/message-id/flat/CABdArM5sw4Q1ZU8HGdo4BSc1A_%2B8xtUNq17j6wcir%3DyMUy19Cg%40mail.gmail.com

Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v1-0001-Add-C-function-get_partition_root.patch application/octet-stream 3.7 KB

Browse pgsql-hackers by date

  From Date Subject
Previous Message Ian Lawrence Barwick 2026-07-17 04:07:29 [PATCH] Add pg_get_event_trigger_ddl() function