Re: pg_comments (was: Allow \dd to show constraint comments)

Lists: pgsql-hackers
From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-10-12 18:49:32
Message-ID: CA+TgmoYTg6FEdPpO+2b4nFuVeCeNRuvvdTfLXzQs1=-C05ViTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Sep 11, 2011 at 10:11 AM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
> On Sat, Sep 10, 2011 at 7:47 PM, Thom Brown <thom(at)linux(dot)com> wrote:
>> Just tested this out on current master.  I tried this on every object
>> capable of having a comment, and the view reports all of them with the
>> correct details.  Doc changes look fine, except for some reason you
>> removed a full-stop (period) from after "For all other object types,
>> this column is zero."
>
> Thanks for the review. Looks like I got confused about where I was
> whacking around in catalogs.sgml, good catch of a spurious change.
> Fixed patch attached.

So, I think the critical question for this patch is "do we want
this?". Tom didn't like it, and I have to admit I'm somewhat
demoralized by the discovery that we can't make effective use of this
in psql. On the flip side, rooting through pg_description and
pg_shdescription with home-grown queries is un-fun, and it's not clear
that \dd solves the problem well enough that we don't need anything
else. On the third hand, Josh's previous batch of changes to clean up
psql's behavior in this area are clearly a huge improvement: you can
now display the comment for nearly anything by running the appropriate
\d<foo> command for whatever the object type is. So ... is this still
a good idea, or should we just forget about it?

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


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-10-13 02:20:07
Message-ID: CAK3UJRGiU7i692e85HJCgqZDZSi29Yr7BrmU7mbTk36e5RoTwg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Oct 12, 2011 at 2:49 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> So, I think the critical question for this patch is "do we want
> this?".

Yep. Or put another way, are the gains worth having another system
view we'll have to maintain forever?

> Tom didn't like it,

In [1], Tom seemed to be mainly angling for fixing up psql instead,
which has been done now. I didn't see a specific reason against adding
the view, other than it "cannot be changed without an initdb". That's
a valid concern of course, but it applies equally well to other system
views.

[snip]
> On the third hand, Josh's previous batch of changes to clean up
> psql's behavior in this area are clearly a huge improvement: you can
> now display the comment for nearly anything by running the appropriate
> \d<foo> command for whatever the object type is.  So ... is this still
> a good idea, or should we just forget about it?

I think this question is a part of a broader concern, namely do we
want to create and support system views for easier access to
information which is already available in different ways through psql
commands, or by manually digging around in the catalogs? I believe
there are at least several examples of existing views we maintain
which are very similar to pg_comments: pg_seclabel seems quite
similar, for instance.

Josh

--
[1] http://archives.postgresql.org/pgsql-hackers/2010-09/msg01081.php


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-10-14 15:12:57
Message-ID: CA+TgmoaO5vN7cDy0H-vaqkwE5ODkxfDn-1JZrZFAXp=xqXLFug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Oct 12, 2011 at 10:20 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>> On the third hand, Josh's previous batch of changes to clean up
>> psql's behavior in this area are clearly a huge improvement: you can
>> now display the comment for nearly anything by running the appropriate
>> \d<foo> command for whatever the object type is.  So ... is this still
>> a good idea, or should we just forget about it?
>
> I think this question is a part of a broader concern, namely do we
> want to create and support system views for easier access to
> information which is already available in different ways through psql
> commands, or by manually digging around in the catalogs? I believe
> there are at least several examples of existing views we maintain
> which are very similar to pg_comments: pg_seclabel seems quite
> similar, for instance.

That's one's a direct analogue, but I don't want to overbroaden the
issue. I guess it just seems to me that if no one's going to champion
adding this, maybe we shouldn't.

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


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Thom Brown <thom(at)linux(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-10-17 02:04:22
Message-ID: CA+TgmoYD5hXv=dfHfqAJA4dtL1kFRcK5VEM=EdgL6qu-F10C3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Oct 14, 2011 at 11:12 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Wed, Oct 12, 2011 at 10:20 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>>> On the third hand, Josh's previous batch of changes to clean up
>>> psql's behavior in this area are clearly a huge improvement: you can
>>> now display the comment for nearly anything by running the appropriate
>>> \d<foo> command for whatever the object type is.  So ... is this still
>>> a good idea, or should we just forget about it?
>>
>> I think this question is a part of a broader concern, namely do we
>> want to create and support system views for easier access to
>> information which is already available in different ways through psql
>> commands, or by manually digging around in the catalogs? I believe
>> there are at least several examples of existing views we maintain
>> which are very similar to pg_comments: pg_seclabel seems quite
>> similar, for instance.
>
> That's one's a direct analogue, but I don't want to overbroaden the
> issue.  I guess it just seems to me that if no one's going to champion
> adding this, maybe we shouldn't.

Hearing no cries of "oh, yes, please", I'm marking this Returned with
Feedback for now. We can always revisit it if we hear that more
people want it.

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


From: Marti Raudsepp <marti(at)juffo(dot)org>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-10-21 15:57:47
Message-ID: CABRT9RDZr+yjJ9NVr=_2tUMbtyiWAiFeBTF-SPKwaVsSLatAhQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Oct 17, 2011 at 05:04, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Hearing no cries of "oh, yes, please", I'm marking this Returned with
> Feedback for now.  We can always revisit it if we hear that more
> people want it.

I think this would be an improvement, but it's pretty low on my
wishlist. I haven't checked the patch though.

Regards,
Marti


From: Thom Brown <thom(at)linux(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-11-09 01:12:03
Message-ID: CAA-aLv5Fh45P_xTwufHT_zp-bJ3=z4NqsM+eG7NejRvZWVBuKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 17 October 2011 03:04, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Fri, Oct 14, 2011 at 11:12 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Wed, Oct 12, 2011 at 10:20 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>>>> On the third hand, Josh's previous batch of changes to clean up
>>>> psql's behavior in this area are clearly a huge improvement: you can
>>>> now display the comment for nearly anything by running the appropriate
>>>> \d<foo> command for whatever the object type is.  So ... is this still
>>>> a good idea, or should we just forget about it?
>>>
>>> I think this question is a part of a broader concern, namely do we
>>> want to create and support system views for easier access to
>>> information which is already available in different ways through psql
>>> commands, or by manually digging around in the catalogs? I believe
>>> there are at least several examples of existing views we maintain
>>> which are very similar to pg_comments: pg_seclabel seems quite
>>> similar, for instance.
>>
>> That's one's a direct analogue, but I don't want to overbroaden the
>> issue.  I guess it just seems to me that if no one's going to champion
>> adding this, maybe we shouldn't.
>
> Hearing no cries of "oh, yes, please", I'm marking this Returned with
> Feedback for now.  We can always revisit it if we hear that more
> people want it.

Why is this marked as done on with Wiki's todo list?

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-11-09 02:42:50
Message-ID: CA+Tgmoai4WchHx4c_nrzyabZ=70kSac6WjBqK8T3vuGavEtb5A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Nov 8, 2011 at 8:12 PM, Thom Brown <thom(at)linux(dot)com> wrote:
> Why is this marked as done on with Wiki's todo list?

I assume you're referring to this item:

--
\dd is missing comments for several types of objects. Comments are
not handled at all for some object types, and are handled by both \dd
and the individual backslash command for others. Consider a system
view like pg_comments to manage this mess.
--

What we did is modify psql so that all the backslash commands display
comments for their corresponding object types, at least when the +
modifier is used. We then made \dd display comments for all object
types that lack their own backslash commands. That seems like it
pretty much covers the todo item.

I initially thought that pg_comments could be used *by psql*, which
seemed to me a good argument in favor of its general utility. When we
didn't end up doing it that way, the view got less appealing to me.
I'm still willing to add it if enough people say they want it, but so
far I think we've gotten about three votes between +0.25 and +0.50 and
a -1 from Tom. Which is not really enough for me to feel like pulling
the trigger.

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


From: Thom Brown <thom(at)linux(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-11-09 08:38:52
Message-ID: CAA-aLv7dtm=pwqDLzZL+dt7ZdhK5uV0LEGZKNwLvggRi9K2EkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 9 November 2011 02:42, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Nov 8, 2011 at 8:12 PM, Thom Brown <thom(at)linux(dot)com> wrote:
>> Why is this marked as done on with Wiki's todo list?
>
> I assume you're referring to this item:
>
> --
> \dd is missing comments for several types of objects.  Comments are
> not handled at all for some object types, and are handled by both \dd
> and the individual backslash command for others. Consider a system
> view like pg_comments to manage this mess.
> --
>
> What we did is modify psql so that all the backslash commands display
> comments for their corresponding object types, at least when the +
> modifier is used.  We then made \dd display comments for all object
> types that lack their own backslash commands.  That seems like it
> pretty much covers the todo item.
>
> I initially thought that pg_comments could be used *by psql*, which
> seemed to me a good argument in favor of its general utility.  When we
> didn't end up doing it that way, the view got less appealing to me.
> I'm still willing to add it if enough people say they want it, but so
> far I think we've gotten about three votes between +0.25 and +0.50 and
> a -1 from Tom.  Which is not really enough for me to feel like pulling
> the trigger.

Okay, I've skim-read this topic too lightly. I understand now.

Can I ask, for which type of object are there comments for which we
still can't easily find without this proposed view?

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_comments (was: Allow \dd to show constraint comments)
Date: 2011-11-09 12:40:10
Message-ID: CA+TgmobCrznfpLzSW45SwedL9bpWcqvhVZ2FbDzBntwXkVXOXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Nov 9, 2011 at 3:38 AM, Thom Brown <thom(at)linux(dot)com> wrote:
> On 9 November 2011 02:42, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Tue, Nov 8, 2011 at 8:12 PM, Thom Brown <thom(at)linux(dot)com> wrote:
>>> Why is this marked as done on with Wiki's todo list?
>>
>> I assume you're referring to this item:
>>
>> --
>> \dd is missing comments for several types of objects.  Comments are
>> not handled at all for some object types, and are handled by both \dd
>> and the individual backslash command for others. Consider a system
>> view like pg_comments to manage this mess.
>> --
>>
>> What we did is modify psql so that all the backslash commands display
>> comments for their corresponding object types, at least when the +
>> modifier is used.  We then made \dd display comments for all object
>> types that lack their own backslash commands.  That seems like it
>> pretty much covers the todo item.
>>
>> I initially thought that pg_comments could be used *by psql*, which
>> seemed to me a good argument in favor of its general utility.  When we
>> didn't end up doing it that way, the view got less appealing to me.
>> I'm still willing to add it if enough people say they want it, but so
>> far I think we've gotten about three votes between +0.25 and +0.50 and
>> a -1 from Tom.  Which is not really enough for me to feel like pulling
>> the trigger.
>
> Okay, I've skim-read this topic too lightly.  I understand now.
>
> Can I ask, for which type of object are there comments for which we
> still can't easily find without this proposed view?

Well, the problem with our backslash commands in general is that they
work fine until they don't. For example, if you want to find a
function by name, \df is completely adequate. You can just type \df
foo* and away you go. But if you want to find a function that
*returns type foo*, it's useless. You've got to manually write a
query, and the level of effort is far higher than just typing a
backslash commands. Or if you want to add columns to or remove
columns from the output, you are out of luck. psql -E is a help, but
it's still kind of a pain.

Now, the problem is even worse than average when it comes to comments,
because extracting the comments typically involves a hairy left join
from whichever table contains the objects over to pg_description
and/or pg_shdescription, and the meanings of the columns in those
tables are not at all evident to the newcomer, who will probably
therefore screw it up. It seemed to me that, for those sorts of
situations, something like pg_comments might be useful.

I think the way that psql handles comments now is a big improvement
over previous releases, and I'm satisfied with it. But there are
certainly situations - especially, when you have a large number of
objects and want to filter them in some slightly unusual way - where
it - or our backslash commands more generally - might be judged
lacking.

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