Supabase database
Supabase update or delete does nothing and shows no error. Why?
Row level security (RLS) found no row this user may change, so Postgres changed nothing and reported success. An update needs an UPDATE policy and, because it has to find the row first, a SELECT policy too; a delete needs a DELETE policy.
TL;DR
- In our lab an update with no UPDATE policy, and an update with no SELECT policy, both returned success and changed nothing.
- An upsert with no UPDATE policy fails with 42501 “(USING expression)”.
- The usual AI fix,
for update using (true)with no role, let a signed-in stranger rewrite every row; with the read policy builders add next to it, a logged-out visitor deleted the whole table. - The fix: owner-only SELECT, UPDATE (with
usingandwith check) and DELETE policies, then check the returned row count.
Why it fails silently
RLS adds a hidden condition to every update and delete. Rows that don’t pass it are skipped, as if they didn’t match your filter. Skipping every row is not an error, so the API answers 200 or 204 and the client sees no error.
Supabase’s RLS guide adds a rule people miss: “To perform an UPDATE operation, a corresponding SELECT policy is required.” When the update has a filter, such as .eq('id', 1), Postgres must read the row to find it, and reading needs a SELECT policy.
What we saw in the lab
A todos table, RLS on, with owner-only SELECT and INSERT policies but no UPDATE or DELETE policy. Alice tried to tick off her own todo through real PostgREST.
alice PATCH own todo done=true: [] [HTTP 200]
alice PATCH, return=minimal: [HTTP 204]
alice DELETE own todo: [] [HTTP 200]
server view: 1:alice task:false | 2:bob task:false
alice upsert own todo (on_conflict=id):
{"code":"42501","message":"new row violates row-level security policy (USING expression) for table \"todos\""} [HTTP 403]
-- then: an UPDATE policy, but the SELECT policy removed
alice PATCH own todo, return=minimal: [HTTP 204]
server view: 1:alice task:false | 2:bob task:falseEvery write “succeeded” and nothing changed. The empty [] is the clue: with .select() after the update, you get back the rows that changed, and there were none.
The quick fix that lets strangers edit rows
AI builders often fix this by adding policies named like the ones below. With no to clause, a policy applies to every role, logged-out visitors included.
create policy "Enable update for all users" on public.todos for update using (true);
create policy "Enable delete for all users" on public.todos for delete using (true);stranger PATCH bob's todo (select policy still owner-only): [] [HTTP 200]
stranger PATCH with no filter: [HTTP 204]
server view: 1:hacked:true | 2:hacked:false
-- with the "Enable read access for all users" policy builders usually add alongside:
stranger PATCH bob's todo: [{"id":2,"user_id":"22222222-…","title":"hacked"}] [HTTP 200]
anon DELETE every todo: [HTTP 204]
server view: (empty)The owner-only SELECT policy stopped a filtered update, but an update with no filter at all still rewrote every row. Our lab ran plain PostgREST, with nothing that refuses an update or delete without a where clause, so test this on your own project before you rely on a filter. Once a read-all policy sat next to it, a logged-out visitor emptied the table in one request.
The fix: owner-only policies for each command
alter table public.todos enable row level security;
create policy "read own" on public.todos
for select to authenticated using ((select auth.uid()) = user_id);
create policy "update own" on public.todos
for update to authenticated
using ((select auth.uid()) = user_id)
with check ((select auth.uid()) = user_id);
create policy "delete own" on public.todos
for delete to authenticated using ((select auth.uid()) = user_id);
-- An upsert also needs an insert policy:
create policy "add own" on public.todos
for insert to authenticated with check ((select auth.uid()) = user_id);using decides which rows the user may change. with check decides what the row may look like afterwards. Without with check, the using rule is reused, which is fine here, but write it out so nobody drops it later.
How to check it worked
alice PATCH own todo: [{"id":1,…,"done":true}] [HTTP 200]
stranger PATCH alice's todo: [] [HTTP 200]
alice moves her todo to bob: {"code":"42501","message":"new row violates row-level security policy for table \"todos\""} [HTTP 403]
alice upsert own todo: [{"id":1,…,"title":"alice task v2"}] [HTTP 200]
alice DELETE bob's todo: [] [HTTP 200]
anon DELETE every todo: [] [HTTP 200]
server view: 1:alice task v2:true | 2:bob task:falseIn your app, add .select() to updates and deletes and treat an empty result as a failure:
const { data, error } = await supabase.from('todos').update({ done: true }).eq('id', id).select()
if (error) throw error
if (data.length === 0) throw new Error('Nothing was updated: check the row exists and the RLS policies')Then try it with a second account: changing someone else’s row must return an empty list.
Ask your AI builder to fix it
Paste this into Lovable, Bolt, Replit or Cursor. It asks for one fix and to see the change first.
Updates and deletes on my todos table change nothing and return no error. Row level security is on. Do not add any policy with using (true) or with check (true), and do not disable RLS. Add owner-only policies for the authenticated role: select using ((select auth.uid()) = user_id); update with both using and with check ((select auth.uid()) = user_id); delete using the same; and an insert policy if the app upserts. Add .select() to the update and delete calls and show an error when no rows come back. Write it as a new migration and show me the exact SQL before you apply it.Questions people ask
Why does Supabase update return success but nothing changes?
Row level security skipped every row, so zero rows were updated, and Postgres doesn't treat that as an error. Usually the table has no UPDATE policy for this user, or no SELECT policy, which an update with a filter also needs.
Does a Supabase update need a SELECT policy?
Yes. Supabase's RLS guide says an UPDATE needs a corresponding SELECT policy. In our lab an update with an UPDATE policy but no SELECT policy changed nothing and returned HTTP 204.
Why does my upsert fail with "new row violates row-level security policy (USING expression)"?
An upsert that hits an existing row becomes an update, so it needs an UPDATE policy as well as INSERT and SELECT. In our lab an upsert with only SELECT and INSERT policies failed with that exact message.
Is "Enable update for all users" safe?
No, for any table where rows belong to someone. With no role named it applies to everyone. In our lab a signed-in stranger rewrote every row, and with a public read policy next to it a logged-out visitor deleted the whole table.
Sources and lab
- Supabase: Row Level Security, read 5 Dec 2026: “To perform an UPDATE operation, a corresponding SELECT policy is required.”
- PostgreSQL: CREATE POLICY, on which policies apply to each command.
- PostgREST discussion #1844: a failed update under RLS returns an empty body.
- Lab: Postgres 17.11 and 18.6 with PostgREST 12.2.12 and a Supabase role shim, real HTTP requests as a logged-out visitor, two owners and a signed-in stranger, 5 Dec 2026. Synthetic data only. Same results on both versions.
Related findings
The checks behind this guide, each with example code, a self-check and the fix.
UPDATE policy missing WITH CHECK
PL-005Always-true policy
PL-012 · comingStrangers can change or delete other people's rows
Free check
Check your migrations for this, free.
Paste a public GitHub repo. The free RLS check reads its supabase/migrations and flags tables with RLS off or no policies, always-true policies, update policies with no WITH CHECK, SECURITY DEFINER functions anyone can call or with no fixed search_path, views that skip RLS and public buckets. It never connects to your database.
Written by Manraj Singh Dhillon. Last checked 5 Dec 2026. Code samples are synthetic and run against your own project; nothing here names a real app. Spotted a mistake? Tell us.