summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
authorRobert Haas2012-03-09 19:34:56 +0000
committerRobert Haas2012-03-09 19:34:56 +0000
commit07d1edb954bc8f5d0e2c010dec8482328af38cb8 (patch)
tree64418e4a346496da207c943b460cd692775f971d /src/backend/commands/tablespace.c
parentb14953932dfdda7d915b9e276a09df8458efeec8 (diff)
Extend object access hook framework to support arguments, and DROP.
This allows loadable modules to get control at drop time, perhaps for the purpose of performing additional security checks or to log the event. The initial purpose of this code is to support sepgsql, but other applications should be possible as well. KaiGai Kohei, reviewed by me.
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 5e10f8c9a33..d66ea3b6c12 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -330,7 +330,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
/* Post creation hook for new tablespace */
InvokeObjectAccessHook(OAT_POST_CREATE,
- TableSpaceRelationId, tablespaceoid, 0);
+ TableSpaceRelationId, tablespaceoid, 0, NULL);
create_tablespace_directories(location, tablespaceoid);
@@ -434,6 +434,15 @@ DropTableSpace(DropTableSpaceStmt *stmt)
aclcheck_error(ACLCHECK_NO_PRIV, ACL_KIND_TABLESPACE,
tablespacename);
+ /* DROP hook for the tablespace being removed */
+ if (object_access_hook)
+ {
+ ObjectAccessDrop drop_arg;
+ memset(&drop_arg, 0, sizeof(ObjectAccessDrop));
+ InvokeObjectAccessHook(OAT_DROP, TableSpaceRelationId,
+ tablespaceoid, 0, &drop_arg);
+ }
+
/*
* Remove the pg_tablespace tuple (this will roll back if we fail below)
*/