Re: psql display of foreign keys

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Pg Hackers <pgsql-hackers@lists.postgresql.org>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Date: 2018-12-05T16:09:54Z
Lists: pgsql-hackers
On 2018-Dec-05, Michael Paquier wrote:

> This has been mentioned on the thread where pg_partition_tree has been
> discussed:
> https://www.postgresql.org/message-id/6baeb45a-6222-6b88-342d-37fc7d3cf89a%40lab.ntt.co.jp
> 
> It got shaved from the final patch for simplicity as we had enough
> issues to deal with first.  Adding a pg_partition_root or a new column
> in pg_partition_tree makes sense.  My guts are telling me that a
> separate function is more instinctive to use.

I agree with your guts ... you can combine them (the functions, not the
guts) to obtain the full view of the partition hierarchy just by
applying pg_partition_root() to the argument of pg_partition_tree.

I think with pg_partition_root we can rewrite the FK queries to avoid
WITH RECURSIVE with pg12 servers, but of course with a pg11 server we'll
have to keep using WITH RECURSIVE.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Commits

  1. Improve psql's \d display of foreign key constraints

  2. pg_partition_ancestors