Multi-tenant row level security in Supabase means every row carries a tenant id and a memberships table says which users belong to which tenant. Three policies read that table: members see their own memberships, and they read and write only documents whose tenant they belong to. Tested on a real PostgreSQL with two tenants.
What a tenant is, to the database
What is multi-tenant RLS? It is row level security where the row's owner is a tenant rather than a user, so the policy cannot compare auth.uid() with the row directly. It has to ask a second table whether the signed-in user belongs to the row's tenant. That second table is the whole pattern. With row level security on and no policy, nothing is visible at all; PostgreSQL : "If no policy exists for the table, a default-deny policy is used, meaning that no rows are visible or can be modified." Proven: before any policy, a member sees 0 documents and no error.
public . tenants ( id , name ) public .…