Row-Level Security

CREATE POLICY

Lock mode ACCESS EXCLUSIVE
Risk MEDIUM
Blocks reads, writes, other DDL
pgfence rule create-policy
CREATE POLICY orders_owner_read ON orders FOR SELECT USING (customer_id = current_setting('app.customer_id')::bigint);

What this does

A brief catalog change with no effect on its own until ROW LEVEL SECURITY is enabled on the table. Verify the corresponding ENABLE ROW LEVEL SECURITY exists and runs after every needed policy is in place.

Read more

More in Row-Level Security