How to solve recusivity probleme with rls

im unable to put rls on all my table because : infinite recursion detected in policy for relation
7 Replies
garyaustin
garyaustin2y ago
If you are selecting from the same table you are putting a select policy on then you need to move the select to a security definer function to bypass RLS.
Deleted User
Deleted UserOP2y ago
In fact, I have two tables audio and audiotodo, except that there rls from the audio table calls the audiotodo table and the rls from audiotodo calls the audio table. even with a function that loops to infinity...
garyaustin
garyaustin2y ago
OK same solution.
Deleted User
Deleted UserOP2y ago
Im really sorry but i don't find the place where i can create security definer function in my supabase interface
garyaustin
garyaustin2y ago
You can use the SQL editor or the Functions UI ( select security definer as advanced option) https://supabase.com/docs/guides/database/functions
Database Functions | Supabase Docs
Creating and using Postgres functions.
Deleted User
Deleted UserOP2y ago
WOW Its working, Really, thank you ❤️

Did you find this page helpful?