-- Each subquery re-triggered the other table's RLS, causing: -- infinite recursion detected in policy for relation "requests" -- (surfaces on the first authenticated SELECT of requests, e.g.
-- FROM within a policy ON organization_members → stack overflow in PostgreSQL. -- Solution: SECURITY DEFINER function that bypasses RLS for the membership check.