Row level security does not work for table owner

蹲街弑〆低调 提交于 2019-12-20 05:38:15

问题


I have a table, customer on which I did the following:

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

However, doing SELECT * FROM customer still returns all the rows.

The current role is myrole

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

As you can see it's not a superuser and it RLS isn't disabled on it.

What am I doing wrong?


回答1:


You forgot to enable row level security for the table.

ALTER TABLE customer enable ROW LEVEL SECURITY;

force only makes sure that RLS is applied if enabled, it does not enable RLS on the table.

Online example: https://rextester.com/TCLZ82421



来源:https://stackoverflow.com/questions/53611961/row-level-security-does-not-work-for-table-owner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!