im logged in, have RLS enabled for all, (uid() = u...
# off-topic
q
im logged in, have RLS enabled for all, (uid() = user_id), trying to insert data, but getting doesn't meet rls policy is there something I'm missing, do I have to pass in user session on the insert method or create a new policy for insert alone?
s
Can you provide a code example and also a screenshot of your RLS page along with pointing out the table you are trying to insert into, it might just be something not configured correctly.
q
Alright, when I get a chance later today I'll send those.
I've figured the insert part out, trying to update table now. with the .eq for the update function, what follows after eg table column or row values that I want to edit?
when I don't use the .eq for update everything for that user changes, need to specify the single row to change
s
Looks like the correct behaviour as there is no way to tell which row you want to update without the eq operator.
q
How would the code look to update the 1st row. Title, description, url is the im looking to change.
s
You will have to tell it something about that row, so you have to use either the
.eg
or
.match
method
Only change I would make here is updating the
user_id
from the client side isn't great, someone could potentially hijack the
supabase.auth.user()
function using their developer console and change the user.id value. I normally do that in the database with either a hook or setting the default for that column to
auth.uid()
at all times
q
alright, tried it with my twitter row it updated it. .eq("title", "Twitter");
i would have to make this dynamic though, ill pay with it some more and see what works
thansk for the help