To test policies on the database itself (i.e., from the SQL Editor or from psql
) without switching to your frontend and logging in as different users, you can utilize the following helper SQL procedures (credits):
grant anon, authenticated to postgres;
create or replace procedure auth.login_as_user (user_email text)
language plpgsql
as $$