A developer encountered an infinite recursion error in PostgreSQL's Row Level Security (RLS) policies while working with Supabase. The issue stemmed from a policy on the `public.cours` table that queried the `public.user_roles` table, which itself had policies that also queried `public.user_roles`. This created a loop when a new `agent_readonly` role was added to the `authenticated` membership, causing PostgreSQL to evaluate all permissive policies. The developer explored solutions like `SECURITY DEFINER` functions and role isolation before ultimately deciding to move role information out of the database and into JWT custom claims. AI
IMPACT N/A
RANK_REASON Developer describes a technical problem and solution related to database security policies.
Read on dev.to — Claude Code tag →
AI-generated summary · Google Gemini · from 1 sources. How we write summaries →