Sergio Merdani
Sergio Merdani

Reputation: 1

Can't create RLS on postgresql

I created a login role in Postgres then I tried to give permissions to modify specified rows on a table using row level security. I've tried thousands times but it doesn't work. I have only one table.

enter image description here

Upvotes: 0

Views: 1928

Answers (1)

Łukasz Kamiński
Łukasz Kamiński

Reputation: 5930

You didn't give enough information on what steps you took to come to your conclusion that it doesn't work, so I'll cover both cases:

  1. You created policy, but didn't enable RLS on table. From documentation:

Note that row-level security must be enabled on the table (using ALTER TABLE ... ENABLE ROW LEVEL SECURITY) in order for created policies to be applied.

  1. You are testing RLS using owner role, superuser role or role that inherits privileges from one of those. They bypass RLS by default. You can force RLS on table owner by ALTER TABLE [..] FORCE ROW LEVEL SECURITY, but you can't do that for superuser.

Upvotes: 3

Related Questions