From 577e21b34f8629ce76651a6388298891f81be99a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 26 Oct 1999 03:12:39 +0000 Subject: 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 ] | COLUMN . | AGGREGATE | FUNCTION (arg1, arg2, ...) | OPERATOR (leftoperand_typ rightoperand_typ) | TRIGGER ON relname> Mike Mascari (mascarim@yahoo.com) --- src/backend/commands/trigger.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/backend/commands/trigger.c') diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 17a26c3c8e9..1bec6aa7626 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -16,6 +16,7 @@ #include "catalog/pg_language.h" #include "catalog/pg_proc.h" #include "catalog/pg_trigger.h" +#include "commands/comment.h" #include "commands/trigger.h" #include "executor/executor.h" #include "miscadmin.h" @@ -297,8 +298,14 @@ DropTrigger(DropTrigStmt *stmt) if (namestrcmp(&(pg_trigger->tgname), stmt->trigname) == 0) { - heap_delete(tgrel, &tuple->t_self, NULL); - tgfound++; + + /*** Delete any comments associated with this trigger ***/ + + DeleteComments(tuple->t_data->t_oid); + + heap_delete(tgrel, &tuple->t_self, NULL); + tgfound++; + } else found++; @@ -355,8 +362,15 @@ RelationRemoveTriggers(Relation rel) tgscan = heap_beginscan(tgrel, 0, SnapshotNow, 1, &key); - while (HeapTupleIsValid(tup = heap_getnext(tgscan, 0))) - heap_delete(tgrel, &tup->t_self, NULL); + while (HeapTupleIsValid(tup = heap_getnext(tgscan, 0))) { + + /*** Delete any comments associated with this trigger ***/ + + DeleteComments(tup->t_data->t_oid); + + heap_delete(tgrel, &tup->t_self, NULL); + + } heap_endscan(tgscan); -- cgit v1.2.3