mirror of
https://github.com/postgres/postgres.git
synced 2025-08-22 21:53:06 +03:00
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)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user