aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/utility.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-10-15 01:49:49 +0000
committerBruce Momjian <bruce@momjian.us>1999-10-15 01:49:49 +0000
commit7acc237744b3e9a697959eec367adb44fff554a7 (patch)
tree1650324239bd74896111cf5922c9463c60d788c5 /src/backend/tcop/utility.c
parent55fa71a9e9c766ec477f4cb41c630f1851fa2adc (diff)
downloadpostgresql-7acc237744b3e9a697959eec367adb44fff554a7.tar.gz
postgresql-7acc237744b3e9a697959eec367adb44fff554a7.zip
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)
Diffstat (limited to 'src/backend/tcop/utility.c')
-rw-r--r--src/backend/tcop/utility.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 0b8d1efcdde..ec617d75369 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.69 1999/09/30 01:12:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.70 1999/10/15 01:49:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -233,6 +233,28 @@ ProcessUtility(Node *parsetree,
}
break;
+ case T_CommentStmt:
+ {
+
+ CommentStmt *statement;
+
+ statement = ((CommentStmt *) parsetree);
+
+ PS_SET_STATUS(commandTag = "COMMENT");
+ CHECK_IF_ABORTED();
+
+#ifndef NO_SECURITY
+ if (!pg_ownercheck(userName, statement->relname, RELNAME))
+ elog(ERROR, "you do not own class \"%s\"", statement->relname);
+#endif
+
+ CommentRelation(statement->relname, statement->attrname,
+ statement->comment);
+ }
+ break;
+
+
+
case T_CopyStmt:
{
CopyStmt *stmt = (CopyStmt *) parsetree;