So I need to allow the `authenticated` role to UPD...
# sql
p
So I need to allow the
authenticated
role to UPDATE the users table?
j
you're referring to something like
GRANT SELECT, UPDATE ON public.users TO authenticated
right? yes you would need these if it's not currently available
cant remember now but i thought all new supabase instances allow
authenticated
user to access tables by default
p
Looks like it isn't if I understand this query results correctly
j
that looks like it is actually, since there's rows with
authenticated
and
public.users
> If I comment out SET LOCAL ROLE authenticated; the query succeeds but when it is there, it fails what is the error message?
p
Rows affected: 0
Commented out it says Rows affected: 1
j
does your
authenticated
user have access to
userAdminMeta
table?
any RLS policy blocking that?
p
OH
That was it
...
I am used to Firestore having complete read access in the policy document
j
yeh gotta check the tables that are referenced haha
at least it works now
p
Thanks dude
So policies are read as if from the user? Is there a way to do it as an "admin" ?
j
'admin' as in the
postgres
user?
special roles like
service_role
,
postgres
,
supabase_admin
all bypass row-level security (RLS), so there isnt really any reading of the policies with those
this is also why your update query worked if you didnt set role to
authenticated
, because you were either using
postgres
or
supabase_admin
may not be directly related but you can create
SECURITY DEFINER
functions that are executed with the privileges of the user that creates the function: https://www.postgresql.org/docs/current/sql-createfunction.html
p
Perfect ta!