summaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
authorBruce Momjian1999-10-26 03:12:39 +0000
committerBruce Momjian1999-10-26 03:12:39 +0000
commit577e21b34f8629ce76651a6388298891f81be99a (patch)
treef03a048bca5a17f70e4fa4337629d2ca52af6b34 /src/backend/commands/trigger.c
parent51f62d505e2aba66bf7870c7bd005cd32e7d0953 (diff)
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 ([email protected])
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r--src/backend/commands/trigger.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 17a26c3c8e..1bec6aa762 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);