On 07/03/2015 10:03 AM, Noah Misch wrote:
> (6) AlterPolicy() calls InvokeObjectPostAlterHook(PolicyRelationId, ...), but
> CreatePolicy() and DropPolicy() lack their respective hook invocations.

Patch attached. Actually AlterPolicy() was also missing its hook -- the
existing InvokeObjectPostAlterHook() was only in rename_policy().

I'm not 100% sure about the hook placement -- would appreciate if
someone could confirm I got it correct.

Joe

diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c
index 4642d7c..77aaaca 100644
*** a/src/backend/commands/policy.c
--- b/src/backend/commands/policy.c
*************** RemovePolicyById(Oid policy_id)
*** 410,415 ****
--- 410,417 ----
  	if (!HeapTupleIsValid(tuple))
  		elog(ERROR, "could not find tuple for policy %u", policy_id);
  
+ 	InvokeObjectDropHook(PolicyRelationId, policy_id, 0);
+ 
  	/*
  	 * Open and exclusive-lock the relation the policy belong to.
  	 */
*************** CreatePolicy(CreatePolicyStmt *stmt)
*** 629,634 ****
--- 631,638 ----
  									 SHARED_DEPENDENCY_POLICY);
  	}
  
+ 	InvokeObjectPostCreateHook(PolicyRelationId, policy_id, 0);
+ 
  	/* Invalidate Relation Cache */
  	CacheInvalidateRelcache(target_table);
  
*************** AlterPolicy(AlterPolicyStmt *stmt)
*** 860,865 ****
--- 864,871 ----
  									 SHARED_DEPENDENCY_POLICY);
  	}
  
+ 	InvokeObjectPostAlterHook(PolicyRelationId, policy_id, 0);
+ 
  	heap_freetuple(new_tuple);
  
  	/* Invalidate Relation Cache */
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to