This patch implements ORACLE's COMMENT SQL command.
Bruce Momjian <bruce@momjian.us>
This patch implements ORACLE's COMMENT SQL command.
>From the ORACLE 7 SQL Language Reference Manual:
-----------------------------------------------------
COMMENT
Purpose:
To add a comment about a table, view, snapshot, or
column into the data dictionary.
Prerequisites:
The table, view, or snapshot must be in your own
schema
or you must have COMMENT ANY TABLE system privilege.
Syntax:
COMMENT ON [ TABLE table ] |
[ COLUMN table.column] IS 'text'
You can effectively drop a comment from the database
by setting it to the empty string ''.
-----------------------------------------------------
Example:
COMMENT ON TABLE workorders IS
'Maintains base records for workorder information';
COMMENT ON COLUMN workorders.hours IS
'Number of hours the engineer worked on the task';
to drop a comment:
COMMENT ON COLUMN workorders.hours IS '';
The current patch will simply perform the insert into
pg_description, as per the TODO. And, of course, when
the table is dropped, any comments relating to it
or any of its attributes are also dropped. I haven't
looked at the ODBC source yet, but I do know from
an ODBC client standpoint that the standard does
support the notion of table and column comments.
Hopefully the ODBC driver is already fetching these
values from pg_description, but if not, it should be
trivial.
Hope this makes the grade,
Mike Mascari
(mascarim@yahoo.com)
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/catalog/heap.c | modified | +153 −9 |
| src/backend/catalog/indexing.c | modified | +4 −1 |
| src/backend/commands/creatinh.c | modified | +49 −1 |
| src/backend/parser/gram.y | modified | +32 −3 |
| src/backend/parser/keywords.c | modified | +2 −1 |
| src/backend/tcop/utility.c | modified | +23 −1 |
| src/include/catalog/heap.h | modified | +4 −1 |
| src/include/catalog/pg_description.h | modified | +2 −1 |
| src/include/commands/creatinh.h | modified | +2 −1 |
| src/include/nodes/nodes.h | modified | +2 −1 |
| src/include/nodes/parsenodes.h | modified | +13 −1 |
| src/tools/pgindent/pgindent | modified | +1 −0 |