From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve psql's \d display of foreign key constraints
Date: Tue, 26 Mar 2019 14:27:40 +0000
Message-ID: <E1h8n3E-0003Sb-J0@gemulon.postgresql.org> (raw)
Improve psql's \d display of foreign key constraints
When used on a partition containing foreign keys coming from one of its
ancestors, \d would (rather unhelpfully) print the details about the
pg_constraint row in the partition. This becomes a bit frustrating when
the user tries things like dropping the FK in the partition; instead,
show the details for the foreign key on the table where it is defined.
Also, when a table is referenced by a foreign key on a partitioned
table, we would show multiple "Referenced by" lines, one for each
partition, which gets unwieldy pretty fast. Modify that so that it
shows only one line for the ancestor partitioned table where the FK is
defined.
Discussion: https://postgr.es/m/20181204143834.ym6euxxxi5aeqdpn@alvherre.pgsql
Reviewed-by: Tom Lane, Amit Langote, Peter Eisentraut
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/1af25ca0c2d9d110bd7bd5be2a14fb20cd93ee78
Modified Files
--------------
src/bin/psql/describe.c | 156 ++++++++++++++++++++++--------
src/test/regress/expected/foreign_key.out | 38 +++++---
src/test/regress/sql/foreign_key.sql | 2 +
3 files changed, 145 insertions(+), 51 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: alvherre@alvh.no-ip.org
Subject: Re: pgsql: Improve psql's \d display of foreign key constraints
In-Reply-To: <E1h8n3E-0003Sb-J0@gemulon.postgresql.org>
References: <E1h8n3E-0003Sb-J0@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox