Re: Add pg_partition_root to get top-most parent of a partition tree

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)postgresql(dot)org>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Subject: Re: Add pg_partition_root to get top-most parent of a partition tree
Date: 2018-12-07 02:46:05
Message-ID: 20181207024605.GQ2407@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 06, 2018 at 10:48:59PM -0300, Alvaro Herrera wrote:
> I think adding a pg_partition_root() call to as many pg_partition_tree
> tests as you modified is overkill ... OTOH I'd have one test that
> invokes pg_partition_tree(pg_partition_root(some-partition)) to verify
> that starting from any point in the tree you get the whole tree.

Good idea, thanks for the input.

> I haven't actually tried to write a query that obtains a tree of
> constraints using this, mind ...

Sure. It would be good to agree on an interface. I have not tried
either, but you should be able to get away with a join on relid returned
by pg_partition_tree() with pg_constraint.conrelid with
pg_get_constraintdef() instead of a WITH RECURSIVE, no?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2018-12-07 03:27:27 Re: zheap: a new storage format for PostgreSQL
Previous Message Alvaro Herrera 2018-12-07 01:48:59 Re: Add pg_partition_root to get top-most parent of a partition tree