Thread: Re: [HACKERS] Re: [PATCHES] COMMENT ON patch

Re: [HACKERS] Re: [PATCHES] COMMENT ON patch

From
Mike Mascari
Date:
--- Peter Eisentraut <peter_e@gmx.net> wrote:
...
> 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?

...
Hmm, this is where I'm getting the oid's:

DATABASE -- pg_database
INDEX -- pg_class
RULE -- pg_rewrite
SEQUENCE -- pg_class
TABLE -- pg_class
TYPE -- pg_type
VIEW -- pg_class
COLUMN -- pg_attribute
AGGREGATE -- pg_aggregate
FUNCTION -- pg_proc
OPERATOR -- pg_operator
TRIGGER -- pg_trigger

So in the example you gave above, you could put a comment
on each of the two functions which compose the operator
and a command on the operator itself.

I still need to write the SGML and change pg_dump to
generate COMMENT ON statements, and also regression tests,
but the functionality should be complete. Just glancing
over the Win32 ODBC driver, it appears that SQLTables() and
SQLColumns() is not currently fetching the associated
description from pg_description for the REMARKS parameter
to the call. Perhaps this could be changed? 

Hope that helps, 

Mike Mascari (looking forward to the new psql...)
(mascarim@yahoo.com)




=====

__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


Re: [HACKERS] Re: [PATCHES] COMMENT ON patch

From
Byron Nikolaidis
Date:

Mike Mascari wrote:
> 
> --- Peter Eisentraut <peter_e@gmx.net> wrote:
> ...
> > 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?
> 
> ...
> Hmm, this is where I'm getting the oid's:
> 
> DATABASE -- pg_database
> INDEX -- pg_class
> RULE -- pg_rewrite
> SEQUENCE -- pg_class
> TABLE -- pg_class
> TYPE -- pg_type
> VIEW -- pg_class
> COLUMN -- pg_attribute
> AGGREGATE -- pg_aggregate
> FUNCTION -- pg_proc
> OPERATOR -- pg_operator
> TRIGGER -- pg_trigger
> 
> So in the example you gave above, you could put a comment
> on each of the two functions which compose the operator
> and a command on the operator itself.
> 
> I still need to write the SGML and change pg_dump to
> generate COMMENT ON statements, and also regression tests,
> but the functionality should be complete. Just glancing
> over the Win32 ODBC driver, it appears that SQLTables() and
> SQLColumns() is not currently fetching the associated
> description from pg_description for the REMARKS parameter
> to the call. Perhaps this could be changed?
> 
> Hope that helps,
> 
> Mike Mascari (looking forward to the new psql...)
> (mascarim@yahoo.com)
> 
> =====
> 
> __________________________________________________
> Do You Yahoo!?
> Bid and sell for free at http://auctions.yahoo.com


It wouldn't be hard to add the pg_description to the remarks.
Does this field exist for all previous postgres releases (specifically,
6.2,6.3, and 6.4) ??

Byron


Re: [HACKERS] Re: [PATCHES] COMMENT ON patch

From
Peter Eisentraut
Date:
On Sun, 24 Oct 1999, Mike Mascari wrote:

> Hmm, this is where I'm getting the oid's:
> 
> DATABASE -- pg_database
> INDEX -- pg_class
> RULE -- pg_rewrite
> SEQUENCE -- pg_class
> TABLE -- pg_class
> TYPE -- pg_type
> VIEW -- pg_class
> COLUMN -- pg_attribute
> AGGREGATE -- pg_aggregate
> FUNCTION -- pg_proc
> OPERATOR -- pg_operator
> TRIGGER -- pg_trigger
> 
> So in the example you gave above, you could put a comment
> on each of the two functions which compose the operator
> and a command on the operator itself.

Very nice, BUT: In the old psql the assumption was that operator comments
are keyed on the underlying function(s?). Since a lot of operators seem to
have comments on them by default, one would have to change this somehow.
Try \do and see for yourself. The fix should be rather simple but I'm not
sure where those descriptions are generated actually.
-Peter

-- 
Peter Eisentraut                  Sernanders vaeg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



Re: [HACKERS] Re: [PATCHES] COMMENT ON patch

From
Tom Lane
Date:
Peter Eisentraut <e99re41@DoCS.UU.SE> writes:
> On Sun, 24 Oct 1999, Mike Mascari wrote:
>> So in the example you gave above, you could put a comment
>> on each of the two functions which compose the operator
>> and a command on the operator itself.

Two functions?  An operator only has one underlying function.
(Aggregates have as many as three though.)

> Try \do and see for yourself. The fix should be rather simple but I'm not
> sure where those descriptions are generated actually.

The default contents of pg_description come from the DESCR() macros in
include/catalog/*.h.  It looks like only pg_proc and pg_type have any
useful info in them in the current state of the source.  I'm guessing
that psql's \do actually looks for a description attached to the
underlying function, rather than one attached to the operator.
        regards, tom lane


Re: [HACKERS] Re: [PATCHES] COMMENT ON patch

From
Bruce Momjian
Date:
> Hmm, this is where I'm getting the oid's:
> 
> DATABASE -- pg_database
> INDEX -- pg_class
> RULE -- pg_rewrite
> SEQUENCE -- pg_class
> TABLE -- pg_class
> TYPE -- pg_type
> VIEW -- pg_class
> COLUMN -- pg_attribute
> AGGREGATE -- pg_aggregate
> FUNCTION -- pg_proc
> OPERATOR -- pg_operator
> TRIGGER -- pg_trigger
> 
> So in the example you gave above, you could put a comment
> on each of the two functions which compose the operator
> and a command on the operator itself.
> 
> I still need to write the SGML and change pg_dump to

Please update the sgml and psqlHelp.c files I have already modified for
you.  I thought you didn't want to do it, so I did it.


> generate COMMENT ON statements, and also regression tests,
> but the functionality should be complete. Just glancing
> over the Win32 ODBC driver, it appears that SQLTables() and
> SQLColumns() is not currently fetching the associated
> description from pg_description for the REMARKS parameter
> to the call. Perhaps this could be changed? 

Hmm.  Never heard of that.

--  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
 


Re: [HACKERS] Re: [PATCHES] COMMENT ON patch

From
Bruce Momjian
Date:
> Peter Eisentraut <e99re41@DoCS.UU.SE> writes:
> > On Sun, 24 Oct 1999, Mike Mascari wrote:
> >> So in the example you gave above, you could put a comment
> >> on each of the two functions which compose the operator
> >> and a command on the operator itself.
> 
> Two functions?  An operator only has one underlying function.
> (Aggregates have as many as three though.)
> 
> > Try \do and see for yourself. The fix should be rather simple but I'm not
> > sure where those descriptions are generated actually.
> 
> The default contents of pg_description come from the DESCR() macros in
> include/catalog/*.h.  It looks like only pg_proc and pg_type have any
> useful info in them in the current state of the source.  I'm guessing
> that psql's \do actually looks for a description attached to the
> underlying function, rather than one attached to the operator.

I can only get oids that are fixed in the include files.  Not sure if it
looks at the function behind the operator.  I just don't remember.

--  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