CHECK GRANT Statement
The CHECK GRANT
query is used to check whether the current user/role has been granted a specific privilege.
Syntax
The basic syntax of the query is as follows:
privilege
— Type of privilege.
Examples
If the user used to be granted the privilege, the responsecheck_grant
will be 1
. Otherwise, the response check_grant
will be 0
.
If table_1.col1
exists and current user is granted by privilege SELECT
/SELECT(con)
or role(with privilege), the response is 1
.
If table_2.col2
doesn't exists, or current user is not granted by privilege SELECT
/SELECT(con)
or role(with privilege), the response is 0
.
Wildcard
Specifying privileges you can use asterisk (*
) instead of a table or a database name. Please check WILDCARD GRANTS for wildcard rules.