N
Neon17mo ago
flat-fuchsia

Help creating RLS user

Hello, I know this is a generic postgres question, but I'm trying to create a user that has NOBYPASSRLS set so I can use RLS similar to supabase. however I'm having trouble setting this up correctly. are there any guides for this for neon?
5 Replies
deep-jade
deep-jade17mo ago
@srossross what issue are you running into
flat-fuchsia
flat-fuchsiaOP17mo ago
Hi Tristan, thanks for the response. I was thinking I would like to login as neondb_owner and then be able to use set role neondb_owner_rls to perform actions similar to the neondb_owner I've tried
>>> set role neon_superuser;
>>> ALTER ROLE "neondb_owner" WITH NOBYPASSRLS;
ERROR: permission denied to alter role (SQLSTATE 42501)
>>> set role neon_superuser;
>>> ALTER ROLE "neondb_owner" WITH NOBYPASSRLS;
ERROR: permission denied to alter role (SQLSTATE 42501)
when I create a new role, I would like to give it the same permissions as neondb_owner
deep-jade
deep-jade17mo ago
you need to log in as the neondb_owner then you should be able make other roles neon_superuser I think
flat-fuchsia
flat-fuchsiaOP17mo ago
I did some google searches, I'm probably not going to be able to do this myself. I was hoping there would be a guide out there also I think I am logged in as neondb_owner
SELECT current_user;
neondb_owner
SELECT current_user;
neondb_owner
deep-jade
deep-jade16mo ago
Backing up for a second. You want to create a new role and grant it NOBYPASSRLS?

Did you find this page helpful?