On Mon, Aug 3, 2026 at 5:47 PM Chao Li <[email protected]> wrote:
>
...
>
> Thanks for updating the patch.
>
> Given the comment:
> ```
> + * Note: This should only be called when it is known that the relation is a
> + * partition or partitioned table.
> ```
>
> Does it make sense to add an Assert for that, like:
> ```
> Assert(get_rel_relispartition(relid) ||
>        RELKIND_HAS_PARTITIONS(get_rel_relkind(relid)));
> ```
>
> Then, maybe we don’t need the final sanity check assert.
>
> Otherwise v5 looks good to me. The new parameter even_if_detached matches the 
> existing get_partition_parent().
>

Until now I had been resisting doing up front validation because:
1. then the delegation from the SQL `pg_partition_root` would be doing
2x validation.
2. get_partition_ancestors was not doing any validation

Anyway, in v6 I've done the following:
1. changed to add a wrapper to avoid 2x validation when called from
the SQL function
2. decided not to worry about validation overheads because Assert is
NOP for a production build anyhow

~~

PSA v6

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

Attachment: v6-0001-Add-C-function-get_partition_root.patch
Description: Binary data

Reply via email to