diff options
| author | Andrew Dunstan | 2022-03-22 13:06:15 +0000 |
|---|---|---|
| committer | Andrew Dunstan | 2022-03-22 14:28:31 +0000 |
| commit | d11e84ea466b4e3855d7bd5142fb68f51c273567 (patch) | |
| tree | 5bb1bf60ef69eaefd8a622c42f58b2550cb630bc /src/backend/utils/misc/guc.c | |
| parent | 29992a6a509b256efc4ac560a1586b51a64b2637 (diff) | |
Add String object access hooks
This caters for cases where the access is to an object identified by
name rather than Oid.
The first user of these is the GUC access controls
Joshua Brindle and Mark Dilger
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/utils/misc/guc.c')
| -rw-r--r-- | src/backend/utils/misc/guc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index e7f0a380e60..932aefc777d 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -43,6 +43,7 @@ #include "access/xlog_internal.h" #include "access/xlogrecovery.h" #include "catalog/namespace.h" +#include "catalog/objectaccess.h" #include "catalog/pg_authid.h" #include "catalog/storage.h" #include "commands/async.h" @@ -8737,6 +8738,18 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt) } /* + * Invoke the post-alter hook for altering this GUC variable. + * + * We do this here rather than at the end, because ALTER SYSTEM is not + * transactional. If the hook aborts our transaction, it will be cleaner + * to do so before we touch any files. + */ + InvokeObjectPostAlterHookArgStr(InvalidOid, name, + ACL_ALTER_SYSTEM, + altersysstmt->setstmt->kind, + false); + + /* * To ensure crash safety, first write the new file data to a temp file, * then atomically rename it into place. * @@ -8907,6 +8920,10 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel) ResetAllOptions(); break; } + + /* Invoke the post-alter hook for setting this GUC variable. */ + InvokeObjectPostAlterHookArgStr(InvalidOid, stmt->name, + ACL_SET_VALUE, stmt->kind, false); } /* |
