File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,6 @@ typedef struct
48
48
* role. In most of these tests the "given role" is the same, namely the
49
49
* active current user. So we can optimize it by keeping a cached list of
50
50
* all the roles the "given role" is a member of, directly or indirectly.
51
- * The cache is flushed whenever we detect a change in pg_auth_members.
52
51
*
53
52
* There are actually two caches, one computed under "has_privs" rules
54
53
* (do not recurse where rolinherit isn't true) and one computed under
@@ -4692,12 +4691,16 @@ initialize_acl(void)
4692
4691
if (!IsBootstrapProcessingMode ())
4693
4692
{
4694
4693
/*
4695
- * In normal mode, set a callback on any syscache invalidation of
4696
- * pg_auth_members rows
4694
+ * In normal mode, set a callback on any syscache invalidation of rows
4695
+ * of pg_auth_members (for each AUTHMEM search in this file) or
4696
+ * pg_authid (for has_rolinherit())
4697
4697
*/
4698
4698
CacheRegisterSyscacheCallback (AUTHMEMROLEMEM ,
4699
4699
RoleMembershipCacheCallback ,
4700
4700
(Datum ) 0 );
4701
+ CacheRegisterSyscacheCallback (AUTHOID ,
4702
+ RoleMembershipCacheCallback ,
4703
+ (Datum ) 0 );
4701
4704
}
4702
4705
}
4703
4706
Original file line number Diff line number Diff line change @@ -346,6 +346,13 @@ SET SESSION AUTHORIZATION regressuser1;
346
346
SELECT * FROM atest3; -- fail
347
347
ERROR: permission denied for relation atest3
348
348
DELETE FROM atest3; -- ok
349
+ BEGIN;
350
+ RESET SESSION AUTHORIZATION;
351
+ ALTER ROLE regress_priv_user1 NOINHERIT;
352
+ SET SESSION AUTHORIZATION regress_priv_user1;
353
+ DELETE FROM atest3;
354
+ ERROR: permission denied for table atest3
355
+ ROLLBACK;
349
356
-- views
350
357
SET SESSION AUTHORIZATION regressuser3;
351
358
CREATE VIEW atestv1 AS SELECT * FROM atest1; -- ok
Original file line number Diff line number Diff line change @@ -216,6 +216,12 @@ SET SESSION AUTHORIZATION regressuser1;
216
216
SELECT * FROM atest3; -- fail
217
217
DELETE FROM atest3; -- ok
218
218
219
+ BEGIN ;
220
+ RESET SESSION AUTHORIZATION;
221
+ ALTER ROLE regress_priv_user1 NOINHERIT;
222
+ SET SESSION AUTHORIZATION regress_priv_user1;
223
+ DELETE FROM atest3;
224
+ ROLLBACK ;
219
225
220
226
-- views
221
227
You can’t perform that action at this time.
0 commit comments