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

HAS_TABLE_PRIVILEGE

Returns true if the user has the specified privilege for the specified table.

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. For more information about privileges, see GRANT.

Copy
has_table_privilege( [ user, ] table, privilege)

Arguments

user

Name of the user to check for table privileges. The default is to check the current user.

table

Table associated with the privilege.

privilege

Privilege to check. Valid values are:

  • SELECT

  • INSERT

  • UPDATE

  • DELETE

  • REFERENCES

Return Type

Returns a CHAR or VARCHAR string.

Examples

The following query finds that the GUEST user does not have SELECT privilege on the LISTING table:

Copy
select has_table_privilege('guest', 'listing', 'select'); has_table_privilege --------------------- false (1 row)