Bug #90736 Why is CURRENT_ROLE not implemented
Submitted: 3 May 2018 13:41 Modified: 3 May 2018 14:01
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Security: Privileges Severity:S4 (Feature request)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[3 May 2018 13:41] Peter Laursen
Description:
Both CURRENT_USER and CURRENT_USER() are implemented (since long ago), but only CURRENT_ROLE() is and CURRENT_ROLE is not. 

I find this inconsistent.

How to repeat:
From my simple environment:

SELECT CURRENT_USER; -- returns "root@localhost"
SELECT CURRENT_USER(); -- returns "root@localhost"
SELECT CURRENT_ROLE; -- Error Code: 1054 - Unknown column 'current_role' in 'field list'
SELECT CURRENT_ROLE(); -- returns 'none' (what is correct)

Suggested fix:
Implement CURRENT_ROLE
[3 May 2018 14:01] MySQL Verification Team
Thank you for the feature request.
[4 May 2018 7:34] Georgi Kodinov
For the record:
https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_current-role

CURRENT_ROLE()

Returns a utf8 string containing the current active roles for the current session, separated by commas, or NONE if there are none

So technically the functionality exists (SELECT CURRENT_ROLE()).
This is a request for the following syntax:
"SELECT CURRENT_ROLE"