GRANT assigns table, schema, and database privileges to users or roles in PostgreSQL and Amazon Redshift.
GRANT adds one or more privileges—such as SELECT, INSERT, or USAGE—to a user, group, or role on a chosen database object. In Redshift, GRANT works the same way as PostgreSQL and supports tables, schemas, sequences, and databases.
Common privileges are SELECT, INSERT, UPDATE, DELETE, REFERENCES, TRUNCATE (table), USAGE (schema), and ALL PRIVILEGES.Choose the minimal set needed for the task to follow the principle of least privilege.
Run GRANT SELECT ON TABLE Orders TO analytics_role; to let analytics_role read order history while blocking writes.
Specify a comma-separated list: GRANT SELECT, UPDATE ON Customers, Orders TO app_user; This minimizes repeated statements and keeps permissions consistent.
Use ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO analytics_role; New tables inherit the privilege automatically.
Grant USAGE on the schema first: GRANT USAGE ON SCHEMA public TO analytics_role; Without USAGE the role cannot access any objects inside the schema even when it has table-level privileges.
Add WITH GRANT OPTION to let the grantee pass privileges onward: GRANT SELECT ON TABLE Products TO lead_dev WITH GRANT OPTION;
Create roles for logical access patterns (e.g., reporting_role) and grant privileges to roles, not individual users.Revoke default PUBLIC privileges to tighten security.
.
Yes. The grantee can pass privileges to others, making auditing harder. Use it sparingly and monitor role memberships.
Use REVOKE, e.g., REVOKE SELECT ON TABLE Orders FROM analytics_role; Revoked rights take effect immediately.
Privileges apply instantly; users may need to reconnect for cache updates, but no server restart is required.