gpt4 book ai didi

database - 如何检查是否为 postgres 中的表启用了行级安全性

转载 作者:搜寻专家 更新时间:2023-10-30 21:55:36 25 4
gpt4 key购买 nike

在 postgres 中对表启用行级安全性非常简单:

alter table some_table enable row level security;

您将如何检查给定架构中的哪些表启用了行级安全性(用于测试)?

最佳答案

这存储在 pg_class

  • relrowsecurity bool 如果表启用了行级安全性则为真;见pg_policy目录
  • relforcerowsecurity bool 如果行级安全性(启用时)也适用于表所有者,则为真;见pg_policy目录

所以你可以使用:

select relname, relrowsecurity, relforcerowsecurity
from pg_class
where oid = 'your_table_name'::regclass;

或者使用 pg_tables

关于database - 如何检查是否为 postgres 中的表启用了行级安全性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55046131/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com