Difference between revisions of "Amazon Redshift: GRANT"
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
* USAGE: Allows users to access objects in the schema. User still needs specific table-level permissions for each table within the schema | * USAGE: Allows users to access objects in the schema. User still needs specific table-level permissions for each table within the schema | ||
* CREATE: Allows users to create objects within a schema using CREATE statement | * CREATE: Allows users to create objects within a schema using CREATE statement | ||
+ | |||
+ | == Show permissions == | ||
+ | <pre> | ||
+ | SELECT | ||
+ | u.usename, | ||
+ | s.schemaname, | ||
+ | has_schema_privilege(u.usename,s.schemaname,'create') AS user_has_select_permission, | ||
+ | has_schema_privilege(u.usename,s.schemaname,'usage') AS user_has_usage_permission | ||
+ | FROM | ||
+ | pg_user u | ||
+ | CROSS JOIN | ||
+ | (SELECT DISTINCT schemaname FROM pg_tables) s | ||
+ | WHERE | ||
+ | u.usename = 'myUserName' | ||
+ | AND s.schemaname = 'mySchemaName' | ||
+ | ; | ||
+ | </pre> | ||
== See also == | == See also == |
Revision as of 08:46, 12 November 2021
GRANT USAGE ON { DATABASE shared_database_name [, ...] | SCHEMA shared_schema} TO { username | GROUP group_name | PUBLIC } [, ...]
Schema level permissions
- USAGE: Allows users to access objects in the schema. User still needs specific table-level permissions for each table within the schema
- CREATE: Allows users to create objects within a schema using CREATE statement
Show permissions
SELECT u.usename, s.schemaname, has_schema_privilege(u.usename,s.schemaname,'create') AS user_has_select_permission, has_schema_privilege(u.usename,s.schemaname,'usage') AS user_has_usage_permission FROM pg_user u CROSS JOIN (SELECT DISTINCT schemaname FROM pg_tables) s WHERE u.usename = 'myUserName' AND s.schemaname = 'mySchemaName' ;
See also
Advertising: