View a markdown version of this page

HAS_DATABASE_PRIVILEGE - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026. We will start enforcing it in phases. For more information on the details of Python end of life and migration options, see the blog post that was published on June 30, 2025.

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.

has_database_privilege( [ user, ] database, privilege)

Arguments

user

The name of the user to check for database privileges. The default is to check the current user.

database

The database associated with the privilege.

privilege

The privilege to check. Valid values are the following:

  • 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.

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