mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Extend object-access hook machinery to support post-alter events.
This also slightly widens the scope of what we support in terms of post-create events. KaiGai Kohei, with a few changes, mostly to the comments, by me
This commit is contained in:
@@ -933,7 +933,8 @@ index_create(Relation heapRelation,
|
||||
false, /* already marked primary */
|
||||
false, /* pg_index entry is OK */
|
||||
false, /* no old dependencies */
|
||||
allow_system_table_mods);
|
||||
allow_system_table_mods,
|
||||
is_internal);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1107,6 +1108,7 @@ index_create(Relation heapRelation,
|
||||
* remove_old_dependencies: if true, remove existing dependencies of index
|
||||
* on table's columns
|
||||
* allow_system_table_mods: allow table to be a system catalog
|
||||
* is_internal: index is constructed due to internal process
|
||||
*/
|
||||
void
|
||||
index_constraint_create(Relation heapRelation,
|
||||
@@ -1119,7 +1121,8 @@ index_constraint_create(Relation heapRelation,
|
||||
bool mark_as_primary,
|
||||
bool update_pgindex,
|
||||
bool remove_old_dependencies,
|
||||
bool allow_system_table_mods)
|
||||
bool allow_system_table_mods,
|
||||
bool is_internal)
|
||||
{
|
||||
Oid namespaceId = RelationGetNamespace(heapRelation);
|
||||
ObjectAddress myself,
|
||||
@@ -1184,7 +1187,8 @@ index_constraint_create(Relation heapRelation,
|
||||
NULL,
|
||||
true, /* islocal */
|
||||
0, /* inhcount */
|
||||
true); /* noinherit */
|
||||
true, /* noinherit */
|
||||
is_internal);
|
||||
|
||||
/*
|
||||
* Register the index as internally dependent on the constraint.
|
||||
@@ -1293,6 +1297,9 @@ index_constraint_create(Relation heapRelation,
|
||||
{
|
||||
simple_heap_update(pg_index, &indexTuple->t_self, indexTuple);
|
||||
CatalogUpdateIndexes(pg_index, indexTuple);
|
||||
|
||||
InvokeObjectPostAlterHookArg(IndexRelationId, indexRelationId, 0,
|
||||
InvalidOid, is_internal);
|
||||
}
|
||||
|
||||
heap_freetuple(indexTuple);
|
||||
|
||||
Reference in New Issue
Block a user