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

From Josh Kupershmidt
Subject Re: patch: Allow \dd to show constraint comments
Date
Msg-id BANLkTinjA+wKmKzyDVqPQ7j2dVeY0Miy6w@mail.gmail.com
Whole thread Raw
In response to Re: patch: Allow \dd to show constraint comments  (Kohei KaiGai <kaigai@kaigai.gr.jp>)
Responses Re: patch: Allow \dd to show constraint comments
Re: patch: Allow \dd to show constraint comments
List pgsql-hackers
On Sat, Jun 18, 2011 at 10:53 AM, Kohei KaiGai <kaigai@kaigai.gr.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

pgsql-hackers by date:

Previous
From: Radosław Smogura
Date:
Subject: Re: XPATH evaluation
Next
From: Mariano Mara
Date:
Subject: Grouping Sets