Re: ORACLE COMMENT statement - Mailing list pgsql-hackers

From Mike Mascari
Subject Re: ORACLE COMMENT statement
Date
Msg-id 19991017035721.19203.rocketmail@web2105.mail.yahoo.com
Whole thread Raw
In response to ORACLE COMMENT statement  (Mike Mascari <mascarim@yahoo.com>)
Responses Re: ORACLE COMMENT statement  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
The intent of the COMMENT ON statement was to 
allow for users to provide comments on user tables, 
views, and the fields which compose them as in
ORACLE. I'll expand the syntax beyond ORACLE's to 
include rules, triggers, and functions. Of course,
all of these are the non-system OIDs (although the 
PostgreSQL super-user could create/drop comments on 
system oid-related objects). The implication is that
I'll have to modify pg_dump to generate COMMENT ON 
commands as well for all user tables, views,
functions,
triggers, and rules. The patch I submitted uses
ORACLE's syntax which requires you to specify the 
schema object type as well as its name, such as:

COMMENT ON TABLE employees IS 'Employee Records';
COMMENT ON COLUMN employees.employee IS 'Employee ID';

so I'll just add:

COMMENT ON RULE...
COMMENT ON TRIGGER...
COMMENT ON FUNCTION...

Hopefully, the Win32 ODBC driver is smart enough to
fetch the comments from pg_description in response
to a call to ::SQLTables or ::SQLColumns, so ODBC
applications can see the user comments supplied
(I'll check this). I don't know about JDBC.

There's currently nothing to stop a user from
performing an INSERT on pg_description using any OID
they please. Perhaps that should be restricted, but
who knows what applications are out there now which,
not having a COMMENT ON statement, are storing 
user comments already in pg_description. 

Hopefully, I'll have the other forms done in the next
few days. As Bruce pointed out, \dd already displays
comments for any type. I was hoping for a single 
psql '\' command to display the table, its comments,
its column definitions, and any comments associated 
with the columns...(an outer join SURE would be 
nice for that -- altough one could always do a 
SELECT ... WHERE join UNION SELECT WHERE NOT EXISTS..)

Anyways,

Hope that helps,

Mike Mascari
(mascarim@yahoo.com)

--- Peter Eisentraut <peter_e@gmx.net> wrote:
> I have another question regarding this: It seems
> that you can attach a
> description (or comment, as it is) to any oid. (Not
> with this command, but
> in general). Is this restricted to system oids (like
> below 16000 or
> whatever it was)? Otherwise comments on any user
> tuple could be created.
> Perhaps this should be explicitly prevented or
> allowed. In the latter case
> perhaps the comment statement could be tweaked. Not
> sure. Just wondering.
> 
>     -Peter
>
> Peter Eisentraut                  Sernanders vaeg
> 10:115
> peter_e@gmx.net                   75262 Uppsala
> http://yi.org/peter-e/            Sweden


=====

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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Marc's initial request to start Postgres95 develop
Next
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] Marc's initial request to start Postgres95 develop