Row-level security.
also: RLS · row level securityA database feature (as in PostgreSQL) that filters rows by policy, such as the session's tenant, so a query missing its WHERE can't leak data.
the two-minute refresher
- A policy like tenant_id = current_setting('app.tenant_id') applies to every query.
- Set the tenant on each connection or transaction from the request context.
- Defence in depth: application filters plus database enforcement.
- The application role must not bypass RLS (no table owner, no BYPASSRLS).