aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/remove.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>1999-10-26 03:12:39 +0000
committerBruce Momjian <bruce@momjian.us>1999-10-26 03:12:39 +0000
commit577e21b34f8629ce76651a6388298891f81be99a (patch)
treef03a048bca5a17f70e4fa4337629d2ca52af6b34 /src/backend/commands/remove.c
parent51f62d505e2aba66bf7870c7bd005cd32e7d0953 (diff)
downloadpostgresql-577e21b34f8629ce76651a6388298891f81be99a.tar.gz
postgresql-577e21b34f8629ce76651a6388298891f81be99a.zip
Hello.
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> Mike Mascari (mascarim@yahoo.com)
Diffstat (limited to 'src/backend/commands/remove.c')
-rw-r--r--src/backend/commands/remove.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/backend/commands/remove.c b/src/backend/commands/remove.c
index a73964cb02c..67cd5c8c2ab 100644
--- a/src/backend/commands/remove.c
+++ b/src/backend/commands/remove.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.37 1999/09/18 19:06:40 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.38 1999/10/26 03:12:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,6 +18,7 @@
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
+#include "commands/comment.h"
#include "commands/defrem.h"
#include "miscadmin.h"
#include "parser/parse_func.h"
@@ -93,7 +94,14 @@ RemoveOperator(char *operatorName, /* operator name */
elog(ERROR, "RemoveOperator: operator '%s': permission denied",
operatorName);
#endif
+
+
+ /*** Delete any comments associated with this operator ***/
+
+ DeleteComments(tup->t_data->t_oid);
+
heap_delete(relation, &tup->t_self, NULL);
+
}
else
{
@@ -147,8 +155,17 @@ SingleOpOperatorRemove(Oid typeOid)
{
key[0].sk_attno = attnums[i];
scan = heap_beginscan(rel, 0, SnapshotNow, 1, key);
- while (HeapTupleIsValid(tup = heap_getnext(scan, 0)))
- heap_delete(rel, &tup->t_self, NULL);
+ while (HeapTupleIsValid(tup = heap_getnext(scan, 0))) {
+
+ /*** This is apparently a routine not in use, but remove ***/
+ /*** any comments anyways ***/
+
+ DeleteComments(tup->t_data->t_oid);
+
+ heap_delete(rel, &tup->t_self, NULL);
+
+ }
+
heap_endscan(scan);
}
heap_close(rel, RowExclusiveLock);
@@ -259,6 +276,11 @@ RemoveType(char *typeName) /* type name to be removed */
}
typeOid = tup->t_data->t_oid;
+
+ /*** Delete any comments associated with this type ***/
+
+ DeleteComments(typeOid);
+
heap_delete(relation, &tup->t_self, NULL);
/* Now, Delete the "array of" that type */
@@ -347,6 +369,10 @@ RemoveFunction(char *functionName, /* function name to be removed */
elog(ERROR, "RemoveFunction: function \"%s\" is built-in", functionName);
}
+ /*** Delete any comments associated with this function ***/
+
+ DeleteComments(tup->t_data->t_oid);
+
heap_delete(relation, &tup->t_self, NULL);
heap_close(relation, RowExclusiveLock);
@@ -418,6 +444,11 @@ RemoveAggregate(char *aggName, char *aggType)
aggName);
}
}
+
+ /*** Remove any comments related to this aggregate ***/
+
+ DeleteComments(tup->t_data->t_oid);
+
heap_delete(relation, &tup->t_self, NULL);
heap_close(relation, RowExclusiveLock);