See the state of every table
The Policies screen lists tables with RLS on or off and the policies attached to each: the command (SELECT, INSERT, UPDATE, DELETE or ALL), the roles it targets, and its USING and WITH CHECK expressions.
Create a policy
Pick a table, a command and roles, then write the expressions. pgquery shows the generated statement before anything runs, for example:
ALTER TABLE playlists ENABLE ROW LEVEL SECURITY;
CREATE POLICY public_playlists_visible
ON playlists FOR SELECT
USING (is_public);
Find the gaps
The Security Advisor flags tables that have RLS disabled, alongside superuser roles, public schema grants, SSL and password hashing settings, and gives an overall score.
Remember
- Table owners and superusers bypass RLS unless you use
FORCE ROW LEVEL SECURITY. - With RLS on and no policies, a table returns no rows to ordinary roles.
- Policies combine with OR within a command unless you create them
AS RESTRICTIVE.