mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
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
This commit is contained in:
@ -14919,6 +14919,13 @@ RoleId: RoleSpec
|
||||
"CURRENT_USER"),
|
||||
parser_errposition(@1)));
|
||||
break;
|
||||
case ROLESPEC_CURRENT_ROLE:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_RESERVED_NAME),
|
||||
errmsg("%s cannot be used as a role name here",
|
||||
"CURRENT_ROLE"),
|
||||
parser_errposition(@1)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
;
|
||||
@ -14950,6 +14957,10 @@ RoleSpec: NonReservedWord
|
||||
}
|
||||
$$ = n;
|
||||
}
|
||||
| CURRENT_ROLE
|
||||
{
|
||||
$$ = makeRoleSpec(ROLESPEC_CURRENT_ROLE, @1);
|
||||
}
|
||||
| CURRENT_USER
|
||||
{
|
||||
$$ = makeRoleSpec(ROLESPEC_CURRENT_USER, @1);
|
||||
|
Reference in New Issue
Block a user