Re: patch: Allow \dd to show constraint comments

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: Allow \dd to show constraint comments
Date: 2011-05-19 14:26:34
Message-ID: BANLkTikn5NSSTvzTP3SFrC6DVycUHEP3JA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 17, 2011 at 10:27 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-05-19 14:32:32 Re: Cannot build docs of 9.1 on Windows
Previous Message Robert Haas 2011-05-19 14:19:24 Re: DOMAINs and CASTs