Difference between revisions of "GRANT"
Jump to navigation
Jump to search
↑ https://stackoverflow.com/a/10353730
↑ https://dba.stackexchange.com/a/184339
Line 29: | Line 29: | ||
* [[View GRANTs on Redshift]]: (<code>[[HAS_TABLE_PRIVILEGE]]</code>) | * [[View GRANTs on Redshift]]: (<code>[[HAS_TABLE_PRIVILEGE]]</code>) | ||
* [[Amazon Redshift: show permissions]]: (<code>[[has_schema_privilege]]</code>) | * [[Amazon Redshift: show permissions]]: (<code>[[has_schema_privilege]]</code>) | ||
+ | * [[Amazon Redshift: grant read only provileges to user]] | ||
== Related terms == | == Related terms == |
Revision as of 13:38, 28 April 2022
- PostgreSQL Documentation: https://www.postgresql.org/docs/current/sql-grant.html
Examples
GRANT ALL PRIVILEGES ON DATABASE YOUR_DB_NAME TO YOUR_USERNAME;
SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, USAGE
GRANT SELECT ON mytable TO xxx
GRANT USAGE GRANT USAGE ON ALL SEQUENCES IN SCHEMA your_schema TO mygrp; [1]
Command: GRANT your_defined_role TO your_username;
- Output:
GRANT ROLE
SELECT * FROM your_table_name; ERROR: permission denied for table your_table_name
- List roles:
\du
orSELECT * FROM pg_roles;
Amazon Redshift
Amazon Redshift system information functions:
Activities
- View GRANTs on Redshift: (
HAS_TABLE_PRIVILEGE
) - Amazon Redshift: show permissions: (
has_schema_privilege
) - Amazon Redshift: grant read only provileges to user
Related terms
- Amazon Redshift: GRANT
\dn+
\ddp
[2]CREATE ROLE
- Connect to a database
- Show databases
- Create database
- Delete database
- Create user
- List users
- List databases
- List tables:
show tables
- GRANT
See also
GRANT
,\ddp
,GRANT USAGE
,GRANT ALL PRIVILEGES
,GRANT SELECT
, View GRANTs on Redshift,has_table_privilege
,has_schema_privilege
,HAS_DATABASE_PRIVILEGE
,SCHEMA
, Privileges,GRANT EXECUTE
Advertising: