has_schema_privilege
is an access privilege inquiry function that checks whether the current user has specific privileges on a schema.
has_schema_privilege
function:
has_schema_privilege()
function will always return TRUE (t)
.
schema
: name of the schema for which you want to check privileges (can be any string value or string columns from other tables)user
: name of the user who has the privileges (can be any string value)privilege
: specifies the specific privilege you want to check for in the schema (currently, the function supports create
and usage
)privilege
is case-insensitive, so you can use lowercase or uppercase notation for the privilege nameCREATE
Privilegehas_schema_privilege()
function to determine if the current user has the create
privilege on a schema named “public”:
TRUE
, which means that the current user has a create
privilege on the “public” schema.
USAGE
Privilegehas_schema_privilege()
function to check for the usage
privilege on a schema. For example, in order to check if the current user can create objects in the “public” schema, you can execute the following code:
TRUE
, which means the current user has usage
privilege on the “public” schema.