Thread: Re: [PATCHES] COMMENT ON patch
On Oct 23, Mike Mascari mentioned: > The following patch extends the COMMENT ON functionality to the > rest of the database objects beyond just tables, columns, and views. The > grammer of the COMMENT ON statement now looks like: > > COMMENT ON [ > [ DATABASE | INDEX | RULE | SEQUENCE | TABLE | TYPE | VIEW ] <objname> | > > COLUMN <relation>.<attribute> | > AGGREGATE <aggname> <aggtype> | > FUNCTION <funcname> (arg1, arg2, ...) | > OPERATOR <op> (leftoperand_typ rightoperand_typ) | > TRIGGER <triggername> ON relname> > ] IS 'text' In related news I'd like to point out that psql's \dd command now supports aggregates, functions, operators, types, relations (tables, views, indices, sequences), rules, and triggers. In addition all the other \d? commands (\da, \df, \dT, \do, \dtvsiS), as well as \l, have comments display switchable. Attribute comments can be seen in \d in a similar fashion. You can also give a comment on \lo_import which can then be seen in \lo_list (=\dl). Seems like all the bases are covered. Just to confirm a few things here: Are you keying rule comments on pg_rewrite.oid? Are operator comments keyed on the oid of the underlying function? (Perhaps that could even be changed so you can put a comment on the operator and a note like "implementation of %^*& operator" on the function. Just a thought.) Now we just have to stick a whole bunch of comments on all system stuff. Where would be a good place to do this? Where are all the comments on the built-in operators generated? -Peter -- Peter Eisentraut Sernanders vaeg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
> In related news I'd like to point out that psql's \dd command now supports > aggregates, functions, operators, types, relations (tables, views, > indices, sequences), rules, and triggers. In addition all the other \d? > commands (\da, \df, \dT, \do, \dtvsiS), as well as \l, have comments > display switchable. Attribute comments can be seen in \d in a similar > fashion. You can also give a comment on \lo_import which can then be seen > in \lo_list (=\dl). Seems like all the bases are covered. OK, I think we need help on this. I have added documentation in psqlHelp.c and comment.sgml. You are mentioning some new psql flags that I don't know we had. Can you send info on that. psql.c and psql-ref.sgml are two areas that need additions based on what you said. > Now we just have to stick a whole bunch of comments on all system stuff. > Where would be a good place to do this? Where are all the comments on the > built-in operators generated? OK, right now, comments are in src/include/catalog as DESC entries. These are pulled out by OID during creation of the *.bki files, and initdb does a COPY to load the description table. One limitation now is that we can only comment objects that have a fixed oid in the system tables because we define the oid at compile time coming from the system table. One idea I had in the past was to store the object type and object name instead in a file during compile, and run some UPDATE during initdb that looked up the oid of the object type and name, and stuffed that initdb-supplied oid into the pg_description table. I think that is the only way you are going to be able to do this properly. Seems your COMMENT command already has this done. You could just dump a file containing COMMENT lines as part of *.bki compile process, and have inintdb run the COMMENT file. That is the best way, I think. -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026
On Tue, 26 Oct 1999, Bruce Momjian wrote: > > In related news I'd like to point out that psql's \dd command now supports > > aggregates, functions, operators, types, relations (tables, views, > > indices, sequences), rules, and triggers. In addition all the other \d? > > commands (\da, \df, \dT, \do, \dtvsiS), as well as \l, have comments > > display switchable. Attribute comments can be seen in \d in a similar > > fashion. You can also give a comment on \lo_import which can then be seen > > in \lo_list (=\dl). Seems like all the bases are covered. > > OK, I think we need help on this. I have added documentation in > psqlHelp.c and comment.sgml. You are mentioning some new psql flags > that I don't know we had. Can you send info on that. psql.c and > psql-ref.sgml are two areas that need additions based on what you said. I implemented sort of shell variables into psql (I mentioned it in the changelogs, but those were admittedly quite long), so you can set variables like: \set foo 'bar' \echo $foo \echo "foo is now ${foo}" etc. The initial motivation was that I would run out of mnemonic flags pretty soon, so most psql state is now in a variable: \set quiet on (-q switch) \set echo on (-e switch) \set echo_secret on (-E switch) etc. (In fact you don't have to set them to "on", anything works. To unset them just write \set varname) The cmd line switches are unaffected, but this way you can also set them within psql. There are also a few variables representing new functionality: \set description on will turn on the display of the object descriptions. There are a few others, too. That's just what I meant with the above. Of course one fine day very soon I'll formally document all of this in DocBook. There is _a lot_ of new stuff, so I might actually end up doing a lot of new documenting. You might want to save yourself the work right now. -Peter -- Peter Eisentraut Sernanders vaeg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden