Re: patch: Allow \dd to show constraint comments - Mailing list pgsql-hackers

From Robert Haas
Subject Re: patch: Allow \dd to show constraint comments
Date
Msg-id BANLkTikn5NSSTvzTP3SFrC6DVycUHEP3JA@mail.gmail.com
Whole thread Raw
In response to patch: Allow \dd to show constraint comments  (Josh Kupershmidt <schmiddy@gmail.com>)
Responses Re: patch: Allow \dd to show constraint comments  (Josh Kupershmidt <schmiddy@gmail.com>)
List pgsql-hackers
On Tue, May 17, 2011 at 10:27 PM, Josh Kupershmidt <schmiddy@gmail.com> wrote:
> Hi all,
>
> Attached is a simple patch addressing the TODO item "Allow \dd to show
> constraint comments". If you have comments on various constraints
> (column, foreign key, primary key, unique, exclusion), they should
> show up via \dd now.
>
> Some example SQL is attached to create two tables with a variety of
> constraints and constraint comments. With the patch, \dd should then
> produce something like this:
>
>                            Object descriptions
>  Schema |         Name         |   Object   |         Description
> --------+----------------------+------------+------------------------------
>  public | bar_c_excl           | constraint | exclusion constraint comment
>  public | bar_pkey             | constraint | two column pkey comment
>  public | bar_uname_check      | constraint | constraint for bar
>  public | bar_uname_fkey       | constraint | fkey comment
>  public | uname_check_not_null | constraint | not null comment
>  public | uname_cons           | constraint | sanity check for uname
>  public | uname_uniq_cons      | constraint | unique constraint comment
> (7 rows)
>
> whereas without the patch, you should see nothing.

At the risk of opening a can of worms, if we're going to fix \dd,
shouldn't we fix it completely, and include comments on ALL the object
types that can have them?  IIRC it's missing a bunch, not just
constraints.

Another thought is that I wonder if it's really useful to have a
backslash commands that dumps out comments on many different object
types.  In some cases, e.g. \db+, we include the description for the
object in the output of the backslash command that lists objects just
of that type, which seems like a better design.  Of course we have no
backslash command for constraints anyway....

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: DOMAINs and CASTs
Next
From: Robert Haas
Date:
Subject: Re: Cannot build docs of 9.1 on Windows