Re: psql: display of object comments

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: display of object comments
Date: 2011-07-27 00:38:09
Message-ID: CAK3UJRG9m0=8AzJqkcZCGr7c-wy=wU7rfgfR5hm10rUTh+9nmw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 25, 2011 at 12:27 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Fri, Jul 22, 2011 at 10:44 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>> On Sat, Jul 9, 2011 at 1:16 PM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>>
>> Attached is an updated version of this patch, lifted out of the recent
>> pg_comments patch. With this v2 patch, \dd should properly show just
>> its five object types, and the psql documentation and help strings
>> should be fixed.
>
> I took a look at this patch today and I think some of these queries
> are not quite right.  When you do a left join against pg_description,
> you have this sort of thing in the WHERE clause:
>
> (d.objsubid IS NULL OR d.objsubid = 0)
>
> I think what you actually want is "AND d.objsubid = 0" in the LEFT
> JOIN's "ON" clause.  Then you are, in effect, only left joining
> against the rows from pg_description where objsubid = 0, and
> null-extending if none such is found.  I think that's what you want.

Thanks for taking a look at this.

Yeah, that is what I was going for. I believe my way worked, since
pg_description declares objsubid NOT NULL, so checking whether
d.objsubid IS NULL in the where clause should just match null-extended
rows. But anyway, your version is clearer, changed.

> I think you can remove the XXX comments, too.  Unless I'm
> misunderstanding something, using the table to test visibility for
> constraints, rules, and triggers seems just right, and opclasses and
> opfamilies you have a suitable function available, so those don't seem
> problematic.  Or am I confused?

I bet you're right; at least, it seems to work reasonably in the
testing I've done. I had just left those comments in there since they
were in all the sub-queries of objectDescription(), but now seems like
a good time to get rid of them.

Josh

Attachment Content-Type Size
describe_comments.v3.patch text/x-patch 74.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Kupershmidt 2011-07-27 01:21:46 Re: psql: bogus descriptions displayed by \d+
Previous Message Josh Berkus 2011-07-26 23:58:48 Re: New partitioning WAS: Check constraints on partition parents only?