Re: Add pg_partition_root to get top-most parent of a partition tree
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Date: 2018-12-07T02:46:05Z
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
Commits
-
Add pg_partition_root to display top-most parent of a partition tree
- 3677a0b26bb2 12.0 landed
-
Tweak pg_partition_tree for undefined relations and unsupported relkinds
- cc53123bcc9d 12.0 cited