You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RLS INSERT policy for anon role rejected by PostgREST despite correct policy configuration #48302
bugSomething isn't workingdocumentationImprovements or additions to documentationexternal-issueCreated outside of Supabasepr-openedA PR has been opened to resolve the issue
GRANT INSERT exists for anon on the table (confirmed via information_schema.table_privileges)
RLS is enabled normally (relrowsecurity=true, relforcerowsecurity=false)
anon role has rolbypassrls=false, rolsuper=false, rolinherit=true (normal, non-superuser role)
A direct SQL test via SET ROLE anon; INSERT INTO ...; succeeds without any error
The same INSERT via the REST API (same payload, same columns) fails with 42501
Ran NOTIFY pgrst, 'reload schema'; — no change
Performed a full project restart (Settings > Restart project) — no change, error persists identically
This strongly suggests a PostgREST-level issue (JWT role mapping, internal cache, or
similar) rather than a database/RLS configuration problem, since Postgres itself accepts
the exact same operation when tested directly.
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
💬 Have feedback or questions? Drop into our discord!
This looks like expected PostgREST / RLS behavior rather than a misconfigured INSERT policy or a PostgREST bug.
When the REST client asks for the inserted row back (Prefer: return=representation, or supabase-js .insert(...).select()), PostgREST runs INSERT … RETURNING *. Postgres then also evaluates SELECT RLS on the new row. An INSERT policy with WITH CHECK (true) plus GRANT INSERT is enough for a plain SQL insert, which is why this succeeds:
set role anon;
insert into prospects …; -- no RETURNING
bugSomething isn't workingdocumentationImprovements or additions to documentationexternal-issueCreated outside of Supabasepr-openedA PR has been opened to resolve the issue
Activity
coderabbitai commentedon Jul 24, 2026
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
rohanpatel2002 commentedon Jul 24, 2026
Triage
This looks like expected PostgREST / RLS behavior rather than a misconfigured INSERT policy or a PostgREST bug.
When the REST client asks for the inserted row back (
Prefer: return=representation, or supabase-js.insert(...).select()), PostgREST runsINSERT … RETURNING *. Postgres then also evaluates SELECT RLS on the new row. An INSERT policy withWITH CHECK (true)plusGRANT INSERTis enough for a plain SQL insert, which is why this succeeds: