Commit a995b371 authored by Michael Paquier's avatar Michael Paquier

Add missing invocations to object access hooks

The following commands have been missing calls to object access hooks
InvokeObjectPost{Create|Alter}Hook normally applied to all commands:
- ALTER RULE RENAME TO
- ALTER USER MAPPING
- CREATE ACCESS METHOD
- CREATE STATISTICS

Thanks also to Robert Haas for the discussion.

Author: Mark Dilger
Reviewed-by: Álvaro Herrera, Michael Paquier
Discussion: https://postgr.es/m/435CD295-F409-44E0-91EC-DF32C7AFCD76@enterprisedb.com
parent c99cec96
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "catalog/catalog.h" #include "catalog/catalog.h"
#include "catalog/dependency.h" #include "catalog/dependency.h"
#include "catalog/indexing.h" #include "catalog/indexing.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_am.h" #include "catalog/pg_am.h"
#include "catalog/pg_proc.h" #include "catalog/pg_proc.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
...@@ -107,6 +108,8 @@ CreateAccessMethod(CreateAmStmt *stmt) ...@@ -107,6 +108,8 @@ CreateAccessMethod(CreateAmStmt *stmt)
recordDependencyOnCurrentExtension(&myself, false); recordDependencyOnCurrentExtension(&myself, false);
InvokeObjectPostCreateHook(AccessMethodRelationId, amoid, 0);
table_close(rel, RowExclusiveLock); table_close(rel, RowExclusiveLock);
return myself; return myself;
......
...@@ -1343,6 +1343,9 @@ AlterUserMapping(AlterUserMappingStmt *stmt) ...@@ -1343,6 +1343,9 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
CatalogTupleUpdate(rel, &tp->t_self, tp); CatalogTupleUpdate(rel, &tp->t_self, tp);
InvokeObjectPostAlterHook(UserMappingRelationId,
umId, 0);
ObjectAddressSet(address, UserMappingRelationId, umId); ObjectAddressSet(address, UserMappingRelationId, umId);
heap_freetuple(tp); heap_freetuple(tp);
......
...@@ -374,6 +374,8 @@ CreateStatistics(CreateStatsStmt *stmt) ...@@ -374,6 +374,8 @@ CreateStatistics(CreateStatsStmt *stmt)
relation_close(datarel, RowExclusiveLock); relation_close(datarel, RowExclusiveLock);
InvokeObjectPostCreateHook(StatisticExtRelationId, statoid, 0);
/* /*
* Invalidate relcache so that others see the new statistics object. * Invalidate relcache so that others see the new statistics object.
*/ */
......
...@@ -1003,6 +1003,8 @@ RenameRewriteRule(RangeVar *relation, const char *oldName, ...@@ -1003,6 +1003,8 @@ RenameRewriteRule(RangeVar *relation, const char *oldName,
CatalogTupleUpdate(pg_rewrite_desc, &ruletup->t_self, ruletup); CatalogTupleUpdate(pg_rewrite_desc, &ruletup->t_self, ruletup);
InvokeObjectPostAlterHook(RewriteRelationId, ruleOid, 0);
heap_freetuple(ruletup); heap_freetuple(ruletup);
table_close(pg_rewrite_desc, RowExclusiveLock); table_close(pg_rewrite_desc, RowExclusiveLock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment