Is there a way to create a policy that allows the ...
# sql
t
Is there a way to create a policy that allows the user to update a specific column (not the whole row) if their uuid is inside another column in the same row?
g
RLS is only rows. I would do that with an rpc call to a function that only updates the column with your check. Then don't allow updates in RLS.
t
well that's sad
Thank you tho
g
@User You might be able to do something in an update trigger function.... You would have RLS for the row based on that column id matching auth.uid(), then in a trigger function BEFORE update set all new.column to their old.column value except the one column... then return new. Not sure that is any cleaner, and it would mean NO ONE COULD update other columns ever unless you check roles and such in the trigger function.
t
yeah that could possibly work