diff options
author | Alvaro Herrera | 2014-12-23 13:22:09 +0000 |
---|---|---|
committer | Alvaro Herrera | 2014-12-23 13:22:09 +0000 |
commit | 1826987a46d079458007b7b6bbcbbd852353adbb (patch) | |
tree | c3598d1d9c006551d2adff2b888112a24f2d03ed /src/backend/utils/misc/superuser.c | |
parent | 7eca575d1c28f6eee2bf4564f3d458d10c4a8f47 (diff) |
Use a bitmask to represent role attributes
The previous representation using a boolean column for each attribute
would not scale as well as we want to add further attributes.
Extra auxilliary functions are added to go along with this change, to
make up for the lost convenience of access of the old representation.
Catalog version bumped due to change in catalogs and the new functions.
Author: Adam Brightwell, minor tweaks by Álvaro
Reviewed by: Stephen Frost, Andres Freund, Álvaro Herrera
Diffstat (limited to 'src/backend/utils/misc/superuser.c')
-rw-r--r-- | src/backend/utils/misc/superuser.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/utils/misc/superuser.c b/src/backend/utils/misc/superuser.c index ff0f94711d7..67d070ca256 100644 --- a/src/backend/utils/misc/superuser.c +++ b/src/backend/utils/misc/superuser.c @@ -58,6 +58,7 @@ superuser_arg(Oid roleid) { bool result; HeapTuple rtup; + RoleAttr attributes; /* Quick out for cache hit */ if (OidIsValid(last_roleid) && last_roleid == roleid) @@ -71,7 +72,8 @@ superuser_arg(Oid roleid) rtup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(roleid)); if (HeapTupleIsValid(rtup)) { - result = ((Form_pg_authid) GETSTRUCT(rtup))->rolsuper; + attributes = ((Form_pg_authid) GETSTRUCT(rtup))->rolattr; + result = (attributes & ROLE_ATTR_SUPERUSER); ReleaseSysCache(rtup); } else |