Recursive policy problem #3495
-
I'm implementing RLS on three tables User, Organization, and Member. Member defines the role a User has in an Organization (if they are a member). We use the Supabase function auth.uid() to get the currently logged-in user. If I want a user to only be able to select member rows of their coworkers (users who are members of the same organization). I would intuitively write a policy like this:
This does not work as it's an infinite recursing policy. Right now I'm thinking that the schema should be changed, but I wanted to hear if any of you have had similar troubles and if so how you managed to overcome them? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
@SebastianLJ can you try the answer suggested here: #3328? In general you'd need a |
Beta Was this translation helpful? Give feedback.
@SebastianLJ can you try the answer suggested here: #3328? In general you'd need a
SECURITY DEFINER
function for things like this.