Who Can See This Row? A Hands-On Guide to PostgreSQL Row-Level Security

I wanted to see what happens when a query in a shared notes app forgets its workspace filter. Let’s give Mira access to one workspace, put notes from two workspaces in the same PostgreSQL table, and run this as the app:

SELECT body FROM whose_row.notes;

Mira gets one row back, Harbor launch checklist. There’s also a note in Orchard, but Mira only belongs to Harbor. PostgreSQL’s row-level security (RLS) checks her membership even though the query never mentions a workspace.

[Read More]