Thread

  1. Re: patch: Allow \dd to show constraint comments

    Josh Kupershmidt <schmiddy@gmail.com> — 2011-06-18T17:43:22Z

    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