I have a postgres table already has row level security enabled, with policy for role1. I want to create another policy for role2. However, when I run
CREATE POLICY policy_name ON {table} AS PERMISSIVE FOR SELECT TO role2 USING (TRUE);
The CREATE POLICY command wants to add a access exclusive lock to the table. However, role1 has active select statement on table, so the CREATE POLICY have to wait for all select statement to finish.
Why the create policy needs access exclusive block? How to get around the lock to run concurrently?
role1.