diff options
author | Noah Misch <noah@leadboat.com> | 2020-12-25 10:41:59 -0800 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2020-12-25 10:42:03 -0800 |
commit | c9669880604221489bd87b8dbe686462d19b4ce4 (patch) | |
tree | b4e14e399e6e829e02fc28760dc9ee3a32fe9f0f /src/backend/utils/adt/acl.c | |
parent | f853ffa22055a27f8d2239982edff6e4b8b958d4 (diff) | |
download | postgresql-c9669880604221489bd87b8dbe686462d19b4ce4.tar.gz postgresql-c9669880604221489bd87b8dbe686462d19b4ce4.zip |
Invalidate acl.c caches when pg_authid changes.
This makes existing sessions reflect "ALTER ROLE ... [NO]INHERIT" as
quickly as they have been reflecting "GRANT role_name". Back-patch to
9.5 (all supported versions).
Reviewed by Nathan Bossart.
Discussion: https://postgr.es/m/20201221095028.GB3777719@rfd.leadboat.com
Diffstat (limited to 'src/backend/utils/adt/acl.c')
-rw-r--r-- | src/backend/utils/adt/acl.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index cfd139e6e92..2273f1cde1b 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -51,7 +51,6 @@ typedef struct * role. In most of these tests the "given role" is the same, namely the * active current user. So we can optimize it by keeping a cached list of * all the roles the "given role" is a member of, directly or indirectly. - * The cache is flushed whenever we detect a change in pg_auth_members. * * There are actually two caches, one computed under "has_privs" rules * (do not recurse where rolinherit isn't true) and one computed under @@ -4690,12 +4689,16 @@ initialize_acl(void) if (!IsBootstrapProcessingMode()) { /* - * In normal mode, set a callback on any syscache invalidation of - * pg_auth_members rows + * In normal mode, set a callback on any syscache invalidation of rows + * of pg_auth_members (for each AUTHMEM search in this file) or + * pg_authid (for has_rolinherit()) */ CacheRegisterSyscacheCallback(AUTHMEMROLEMEM, RoleMembershipCacheCallback, (Datum) 0); + CacheRegisterSyscacheCallback(AUTHOID, + RoleMembershipCacheCallback, + (Datum) 0); } } |