aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/acl.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-09-17 11:39:28 +0200
committerPeter Eisentraut <peter@eisentraut.org>2020-09-17 11:40:08 +0200
commit45b9805706fdc726906fc9187c9a7b38c559755c (patch)
treeef61233750b2bb15746a08f7001d927196f5c965 /src/backend/utils/adt/acl.c
parent16fa9b2b30a357b4aea982bd878ec2e5e002dbcc (diff)
downloadpostgresql-45b9805706fdc726906fc9187c9a7b38c559755c.tar.gz
postgresql-45b9805706fdc726906fc9187c9a7b38c559755c.zip
Allow CURRENT_ROLE where CURRENT_USER is accepted
In the particular case of GRANTED BY, this is specified in the SQL standard. Since in PostgreSQL, CURRENT_ROLE is equivalent to CURRENT_USER, and CURRENT_USER is already supported here, adding CURRENT_ROLE is trivial. The other cases are PostgreSQL extensions, but for the same reason it also makes sense there. Reviewed-by: Vik Fearing <vik@postgresfriends.org> Reviewed-by: Asif Rehman <asifr.rehman@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/f2feac44-b4c5-f38f-3699-2851d6a76dc9%402ndquadrant.com
Diffstat (limited to 'src/backend/utils/adt/acl.c')
-rw-r--r--src/backend/utils/adt/acl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index de3f49637e2..f97489f0644 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -5217,6 +5217,7 @@ get_rolespec_oid(const RoleSpec *role, bool missing_ok)
oid = get_role_oid(role->rolename, missing_ok);
break;
+ case ROLESPEC_CURRENT_ROLE:
case ROLESPEC_CURRENT_USER:
oid = GetUserId();
break;
@@ -5259,6 +5260,7 @@ get_rolespec_tuple(const RoleSpec *role)
errmsg("role \"%s\" does not exist", role->rolename)));
break;
+ case ROLESPEC_CURRENT_ROLE:
case ROLESPEC_CURRENT_USER:
tuple = SearchSysCache1(AUTHOID, GetUserId());
if (!HeapTupleIsValid(tuple))