aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tsearchcmds.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2010-11-25 11:48:49 -0500
committerRobert Haas <rhaas@postgresql.org>2010-11-25 11:50:13 -0500
commitcc1ed40d57aa68322e43a7b0a3320a6c5aff010a (patch)
tree9ea4ae8d86ab1e9709e16357a05040700acbe02a /src/backend/commands/tsearchcmds.c
parentd3c126544342728ab4b5c167b4f4b01a39270db5 (diff)
downloadpostgresql-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/tsearchcmds.c')
-rw-r--r--src/backend/commands/tsearchcmds.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c
index 73b8c9248b0..412b1d278d5 100644
--- a/src/backend/commands/tsearchcmds.c
+++ b/src/backend/commands/tsearchcmds.c
@@ -23,6 +23,7 @@
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
+#include "catalog/objectaccess.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_ts_config.h"
@@ -263,6 +264,9 @@ DefineTSParser(List *names, List *parameters)
makeParserDependencies(tup);
+ /* Post creation hook for new text search parser */
+ InvokeObjectAccessHook(OAT_POST_CREATE, TSParserRelationId, prsOid, 0);
+
heap_freetuple(tup);
heap_close(prsRel, RowExclusiveLock);
@@ -563,6 +567,10 @@ DefineTSDictionary(List *names, List *parameters)
makeDictionaryDependencies(tup);
+ /* Post creation hook for new text search dictionary */
+ InvokeObjectAccessHook(OAT_POST_CREATE,
+ TSDictionaryRelationId, dictOid, 0);
+
heap_freetuple(tup);
heap_close(dictRel, RowExclusiveLock);
@@ -1050,6 +1058,9 @@ DefineTSTemplate(List *names, List *parameters)
makeTSTemplateDependencies(tup);
+ /* Post creation hook for new text search template */
+ InvokeObjectAccessHook(OAT_POST_CREATE, TSTemplateRelationId, dictOid, 0);
+
heap_freetuple(tup);
heap_close(tmplRel, RowExclusiveLock);
@@ -1440,6 +1451,9 @@ DefineTSConfiguration(List *names, List *parameters)
makeConfigurationDependencies(tup, false, mapRel);
+ /* Post creation hook for new text search configuration */
+ InvokeObjectAccessHook(OAT_POST_CREATE, TSConfigRelationId, cfgOid, 0);
+
heap_freetuple(tup);
if (mapRel)