Re: patch: Allow \dd to show constraint comments

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: Allow \dd to show constraint comments
Date: 2011-06-18 17:43:22
Message-ID: BANLkTinjA+wKmKzyDVqPQ7j2dVeY0Miy6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jun 18, 2011 at 10:53 AM, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> wrote:

> At first, I noticed three missing object classes although COMMENT ON allows to
> set a description on 'collation', 'extension' and 'foreign table'.

Good catch. Attached patch adds these types in.

> In addition, this pg_comments system view supports 'access method' class, but
> we cannot set a comment on access methods using COMMENT ON statement.

Well, there are comments for the built-in access methods, i.e.

test=# select * from pg_comments WHERE objtype = 'access method';
objoid | classoid | objsubid | objtype | objnamespace | objname
| description
--------+----------+----------+---------------+--------------+---------+----------------------------
403 | 2601 | 0 | access method | | btree
| b-tree index access method
405 | 2601 | 0 | access method | | hash
| hash index access method
783 | 2601 | 0 | access method | | gist
| GiST index access method
2742 | 2601 | 0 | access method | | gin
| GIN index access method
(4 rows)

So I think it's useful to leave objtype = 'access method' in
pg_comments. I guess the assumption is that the only time you would
need to tweak a comment on an access method is if you're building your
own, and if so you can enter the comment into the catalogs manually.

> Regarding to the data-type of objnamespace, how about an idea to define a new
> data type such as 'regschema' and cast objnamespace into this type?
> If we have such data type, user can reference string expression of schema name,
> and also available to use OID joins.

Are you suggesting we leave the structure of pg_comments unchanged,
but introduce a new 'regschema' type so that if users want to easily
display the schema name of an object, they can just do:

SELECT objnamespace::regschema, ...
FROM pg_comments WHERE ... ;

That seems reasonable to me.

Josh

Attachment Content-Type Size
pg_comments.v5.patch application/octet-stream 69.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mariano Mara 2011-06-18 18:09:29 Grouping Sets
Previous Message Radosław Smogura 2011-06-18 16:51:26 Re: XPATH evaluation