diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-11-25 11:48:49 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-11-25 11:50:13 -0500 |
commit | cc1ed40d57aa68322e43a7b0a3320a6c5aff010a (patch) | |
tree | 9ea4ae8d86ab1e9709e16357a05040700acbe02a /src/backend/commands/opclasscmds.c | |
parent | d3c126544342728ab4b5c167b4f4b01a39270db5 (diff) | |
download | postgresql-cc1ed40d57aa68322e43a7b0a3320a6c5aff010a.tar.gz postgresql-cc1ed40d57aa68322e43a7b0a3320a6c5aff010a.zip |
Object access hook framework, with post-creation hook.
After a SQL object is created, we provide an opportunity for security
or logging plugins to get control; for example, a security label provider
could use this to assign an initial security label to newly created
objects. The basic infrastructure is (hopefully) reusable for other types
of events that might require similar treatment.
KaiGai Kohei, with minor adjustments.
Diffstat (limited to 'src/backend/commands/opclasscmds.c')
-rw-r--r-- | src/backend/commands/opclasscmds.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index 132c4ee1e53..5055fb17cde 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -22,6 +22,7 @@ #include "access/sysattr.h" #include "catalog/dependency.h" #include "catalog/indexing.h" +#include "catalog/objectaccess.h" #include "catalog/pg_amop.h" #include "catalog/pg_amproc.h" #include "catalog/pg_namespace.h" @@ -307,6 +308,10 @@ CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid) /* dependency on owner */ recordDependencyOnOwner(OperatorFamilyRelationId, opfamilyoid, GetUserId()); + /* Post creation hook for new operator family */ + InvokeObjectAccessHook(OAT_POST_CREATE, + OperatorFamilyRelationId, opfamilyoid, 0); + heap_close(rel, RowExclusiveLock); return opfamilyoid; @@ -703,6 +708,10 @@ DefineOpClass(CreateOpClassStmt *stmt) /* dependency on owner */ recordDependencyOnOwner(OperatorClassRelationId, opclassoid, GetUserId()); + /* Post creation hook for new operator class */ + InvokeObjectAccessHook(OAT_POST_CREATE, + OperatorClassRelationId, opclassoid, 0); + heap_close(rel, RowExclusiveLock); } |