row-level security

A database feature that filters which rows each query may see or change, using policies the database enforces itself.

In more detail

In PostgreSQL you enable RLS on a table and write a policy such as tenant_id = current_setting('app.tenant'). Even a query that forgets its WHERE clause then only sees the current tenant’s rows, as long as the session setting is correct and reset between requests.

Related terms

Taught in

References