PostgreSQL RLS policies do not compete for precedence. For each command and role, PostgreSQL gathers the applicable policies and combines them by policy mode: permissive policies form an OR group, while restrictive policies form an AND group. The effective decision is therefore “at least one permissive rule passes, and every restrictive rule passes.”
A small tenant-records design makes the distinction concrete. Put tenant ownership in a permissive policy: it establishes the rows the current caller may consider. Put the active-record requirement in a restrictive policy: it narrows those candidate rows so archived records remain unavailable. A row belonging to the tenant but marked inactive is denied; an active row in another tenant is also denied.
This choice is useful when access has both an additive baseline and a non-negotiable constraint. Additional permissive policies can widen the candidate set for a role or use case. Additional restrictive policies can add guards that all m
Discussion
Don’t hold back—comment!
Don’t wait—start sharing your ideas now!