英文:
Do I need to REVOKE permissions when a table is dropped
问题
需要在降级迁移中添加以下内容吗?
```sql
REVOKE SELECT, INSERT, DELETE ON table1 FROM user;
英文:
As part of a migration I create a table and grant permissions to a user. Do I need to REVOKE
the permissions on my downgrade migration which already drops the table?
--- up.sql
CREATE TABLE IF NOT EXISTS table1 (id int primary key);
GRANT SELECT, INSERT, DELETE ON TABLE table1 TO user1;
--- down.sql
DROP TABLE IF EXISTS table1;
Do I need to add the following or is it implicit?
REVOKE SELECT, INSERT, DELETE ON table1 FROM user;
答案1
得分: 1
如果您丢弃一个对象,它的所有权限也会丢失。这是因为权限存储在对象本身上:在表的情况下,权限存储在pg_class
表的relacl
列中(其中存储了所有表)。
英文:
If you drop an object, all its privileges are also gone. That is because privileges are stored on the object itself: in the case of a table, the privileges are stored in the relacl
column of the pg_class
table (where all tables are stored).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论