mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Add context info to OAT_POST_CREATE security hook
... and have sepgsql use it to determine whether to check permissions during certain operations. Indexes that are being created as a result of REINDEX, for instance, do not need to have their permissions checked; they were already checked when the index was created. Author: KaiGai Kohei, slightly revised by me
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/heap.h"
|
||||
#include "catalog/index.h"
|
||||
#include "catalog/objectaccess.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
#include "catalog/pg_constraint.h"
|
||||
#include "catalog/pg_operator.h"
|
||||
@@ -686,7 +687,8 @@ index_create(Relation heapRelation,
|
||||
bool initdeferred,
|
||||
bool allow_system_table_mods,
|
||||
bool skip_build,
|
||||
bool concurrent)
|
||||
bool concurrent,
|
||||
bool is_internal)
|
||||
{
|
||||
Oid heapRelationId = RelationGetRelid(heapRelation);
|
||||
Relation pg_class;
|
||||
@@ -1018,6 +1020,17 @@ index_create(Relation heapRelation,
|
||||
Assert(!initdeferred);
|
||||
}
|
||||
|
||||
/* Post creation hook for new index */
|
||||
if (object_access_hook)
|
||||
{
|
||||
ObjectAccessPostCreate post_create_args;
|
||||
|
||||
memset(&post_create_args, 0, sizeof(ObjectAccessPostCreate));
|
||||
post_create_args.is_internal = is_internal;
|
||||
(*object_access_hook)(OAT_POST_CREATE, RelationRelationId,
|
||||
indexRelationId, 0, &post_create_args);
|
||||
}
|
||||
|
||||
/*
|
||||
* Advance the command counter so that we can see the newly-entered
|
||||
* catalog tuples for the index.
|
||||
|
||||
Reference in New Issue
Block a user