gpt4 book ai didi

postgresql - 行级安全性不适用于表所有者

转载 作者:行者123 更新时间:2023-11-29 14:29:39 25 4
gpt4 key购买 nike

我有一张表,customer,我在上面执行了以下操作:

ALTER TABLE customer FORCE ROW LEVEL SECURITY;
CREATE POLICY customer_rls ON customer USING (false);

但是,执行 SELECT * FROM customer 仍会返回所有行。

当前角色是myrole

\dg myrole
List of roles
Role name | Attributes | Member of
-----------+------------+-----------
my_role | | {}

如您所见,它不是 super 用户,也没有禁用 RLS。

我做错了什么?

最佳答案

您忘记为表启用行级安全性。

ALTER TABLE customer enable ROW LEVEL SECURITY;

force 仅确保在启用时应用 RLS,它不会在表上启用 RLS。

在线示例:https://rextester.com/TCLZ82421

关于postgresql - 行级安全性不适用于表所有者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53611961/

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