0

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?

Luka Horvat
  • 4,283
  • 3
  • 30
  • 48

1 Answers1

3

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