How can I set up an on insert RLS policy? Google h...
# help
v
How can I set up an on insert RLS policy? Google has returned me no examples of help, and my requests always error even if I set with check to just be true.
Copy code
sql
CREATE POLICY "Allow users to insert their credentials"
    ON public.credentials
    AS PERMISSIVE
    FOR insert
    TO public
    with check(true);
h
Was this made with the UI?
v
But the library then decides to say
"new row violates row-level security policy for table "credentials""
No, I'm self-hosting
z
do u have a policy for
select
v
I don't no
z
yes so
when u insert
the library also returns the new row u inserted
which is a selct query
v
Aaah
z
so u can either give selct a policy
or u can set the return type of the query to be
minimal
one sec ill fetch the docs for thta
v
OOOOOH
IT WORKS NOW
z
yes
nice
lol
v
Thank you!
Now to get update to work so I can upsert
Does on conflict require to be able to select?
It seems that it does
It seems like it does