mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Support more commands in event triggers
COMMENT, SECURITY LABEL, and GRANT/REVOKE now also fire ddl_command_start and ddl_command_end event triggers, when they operate on database-local objects. Reviewed-By: Michael Paquier, Andres Freund, Stephen Frost
This commit is contained in:
@ -267,8 +267,12 @@ check_ddl_tag(const char *tag)
|
||||
pg_strcasecmp(tag, "REFRESH MATERIALIZED VIEW") == 0 ||
|
||||
pg_strcasecmp(tag, "ALTER DEFAULT PRIVILEGES") == 0 ||
|
||||
pg_strcasecmp(tag, "ALTER LARGE OBJECT") == 0 ||
|
||||
pg_strcasecmp(tag, "COMMENT") == 0 ||
|
||||
pg_strcasecmp(tag, "GRANT") == 0 ||
|
||||
pg_strcasecmp(tag, "REVOKE") == 0 ||
|
||||
pg_strcasecmp(tag, "DROP OWNED") == 0 ||
|
||||
pg_strcasecmp(tag, "IMPORT FOREIGN SCHEMA") == 0)
|
||||
pg_strcasecmp(tag, "IMPORT FOREIGN SCHEMA") == 0 ||
|
||||
pg_strcasecmp(tag, "SECURITY LABEL") == 0)
|
||||
return EVENT_TRIGGER_COMMAND_TAG_OK;
|
||||
|
||||
/*
|
||||
@ -1149,6 +1153,34 @@ EventTriggerSupportsObjectClass(ObjectClass objclass)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
EventTriggerSupportsGrantObjectType(GrantObjectType objtype)
|
||||
{
|
||||
switch (objtype)
|
||||
{
|
||||
case ACL_OBJECT_DATABASE:
|
||||
case ACL_OBJECT_TABLESPACE:
|
||||
/* no support for global objects */
|
||||
return false;
|
||||
|
||||
case ACL_OBJECT_COLUMN:
|
||||
case ACL_OBJECT_RELATION:
|
||||
case ACL_OBJECT_SEQUENCE:
|
||||
case ACL_OBJECT_DOMAIN:
|
||||
case ACL_OBJECT_FDW:
|
||||
case ACL_OBJECT_FOREIGN_SERVER:
|
||||
case ACL_OBJECT_FUNCTION:
|
||||
case ACL_OBJECT_LANGUAGE:
|
||||
case ACL_OBJECT_LARGEOBJECT:
|
||||
case ACL_OBJECT_NAMESPACE:
|
||||
case ACL_OBJECT_TYPE:
|
||||
return true;
|
||||
default:
|
||||
Assert(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare event trigger state for a new complete query to run, if necessary;
|
||||
* returns whether this was done. If it was, EventTriggerEndCompleteQuery must
|
||||
|
Reference in New Issue
Block a user