AdvancedAdvanced PostgreSQL
Row-Level Security (RLS)
The query
SQL
ALTER TABLE employees ENABLE ROW LEVEL SECURITY;
CREATE POLICY emp_self_view ON employees
FOR SELECT
USING (email = current_user);Note
“RLS restricts which rows a user can see or modify based on a condition. Here, a user can only query their own row.