Menu
Amazon Redshift
Database Developer Guide (API Version 2012-12-01)

HAS_DATABASE_PRIVILEGE

Returns true if the user has the specified privilege for the specified database. For more information about privileges, see GRANT.

Syntax

Note

This is a leader-node function. This function returns an error if it references a user-created table, an STL or STV system table, or an SVV or SVL system view.

Copy
has_database_privilege( [ user, ] database, privilege)

Arguments

user

Name of the user to check for database privileges. Default is to check the current user.

database

Database associated with the privilege.

privilege

Privilege to check. Valid values are:

  • CREATE

  • TEMPORARY

  • TEMP

Return Type

Returns a CHAR or VARCHAR string.

Example

The following query confirms that the GUEST user has the TEMP privilege on the TICKIT database:

Copy
select has_database_privilege('guest', 'tickit', 'temp'); has_database_privilege ------------------------ true (1 row)