docs
Supabase Read-Only Account

Creating a Read Only Supabase Account

We can create a special read only account for Supabase if we don't have one already.

-- Create a new user named chatdb_read_only
CREATE USER chatdb_read_only WITH ENCRYPTED PASSWORD 'PASSWORD-FOR-NEW-USER';
 
-- Grant the supabase_read_only_user role to the chatdb_read_only user
GRANT supabase_read_only_user TO chatdb_read_only;
 
-- Grant the pg_read_all_data role to the chatdb_read_only user
GRANT pg_read_all_data TO chatdb_read_only;
 
-- Alter the chatdb_read_only user to have the BYPASSRLS privilege
-- This allows the user to bypass Row Level Security (RLS) if needed
ALTER ROLE chatdb_read_only WITH BYPASSRLS;

Connect with ChatDB

You can use your chatdb_read_only as the user name. If you are using session pooling with Supabase you may have to add your supabase project id with it.

Supabase Connect Postgres