Bug #75423 Add option for quoting for CURRENT_USER() and USER()
Submitted: 6 Jan 2015 13:08
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Security: Privileges Severity:S4 (Feature request)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any
Tags: current_user, grantee, user

[6 Jan 2015 13:08] Daniël van Eeden
Description:
Quotes are used for information_schema.user_privileges.GRANTEE, but CURRENT_USER() and USER() return the name without quotes.

How to repeat:
This doesn't work:
select * from information_schema.user_privileges where PRIVILEGE_TYPE='SHOW VIEW' and GRANTEE=CURRENT_USER();

This does work, but is not optimal:
select * from information_schema.user_privileges where PRIVILEGE_TYPE='SHOW VIEW' and GRANTEE=CONCAT('\'',REPLACE(CURRENT_USER(),'@','\'@\''),'\'');

Suggested fix:
Add CURRENT_USER('QUOTED') or CURRENT_USER_QUOTED() or some other method to make it possible to match the GRANTEE column.