- 最新
- 最多得票
- 最多評論
To provide access on newly created tables in the schema to your role, you can use ALTER DEFAULT PRIVILEGES
Each "user_write" role user should execute the ALTER DEFAULT PRIVILEGE statement once before creating new tables. By executing this statement, the user is defining the privileges that should be automaticllay applied for the objects they are creating. Syntax for "Alter default privilege" is:
ALTER DEFAULT PRIVILEGES
[ FOR USER target_user [, ...] ]
[ IN SCHEMA schema_name [, ...] ]
grant_or_revoke_clause
For example: consider user1 is assigned the role user_write. Before creating tables, user1 should execute the below ALTER DEFAULT PRIVILEGE statement
ALTER DEFAULT PRIVILEGES IN SCHEMA schema1 GRANT SELECT ON TABLES to role user_read;
By executing this, user1 is indicating that for all the tables they create, a SELECT is automatically granted to user_read role. From that point, any table that user1 creates will have an automatic SELECT grant to user_read role.
If there is another user user2 assigned to role user_write, they need to follow the same mentioned above
相關內容
- 已提問 10 個月前
- 已提問 6 個月前
- AWS 官方已更新 3 年前
- AWS 官方已更新 3 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 2 年前