Short answer
When row level security hides a row from an update or delete, Postgres skips it without an error. Supabase then returns error: null and nothing changed. The usual causes: no update or delete policy, no select policy for the filtered row, a policy whose USING does not match the row, a filter that matches nothing, or a signed-out request. Chain .select() to see how many rows changed, then add owner policies. Never fix it with using (true).
Ask an AI about this page:ChatGPTClaude
On this page
There is no error message, and that is the problem. Your .update() or .delete() returns error: null, the app shows “Saved”, and after a reload the old value is back. Postgres did not fail: it ran the statement on zero rows. With row level security, rows a user may not update or delete are skipped silently, exactly as if your filter had matched nothing. The PostgreSQL docs say it plainly: such rows are “silently suppressed; no error is reported”.
Find your cause in 30 seconds
| What you see | Most likely cause |
|---|---|
| Reading and creating work, changing and deleting do not | No update or delete policy |
| You added an update policy and it still does nothing | No select policy for the row |
| It works for some rows or some users, not others | The policy does not match the row |
| It does nothing in the SQL editor too | The filter matches nothing |
| It works after logging in again, or never on a public page | The request is signed out |
We reproduced all five on Postgres with Supabase’s roles before writing this page. The table is a typical generated migration: policies to read and create notes, none to change or delete them.
create table public.notes (
id uuid primary key default gen_random_uuid(),
user_id uuid not null default auth.uid() references auth.users (id) on delete cascade,
body text not null
);
alter table public.notes enable row level security;
create policy "Users can read their notes"
on public.notes for select to authenticated
using ((select auth.uid()) = user_id);
create policy "Users can add their own notes"
on public.notes for insert to authenticated
with check ((select auth.uid()) = user_id);First, make the silent failure visible
By default, supabase-js does not return updated or deleted rows. Chain .select() after the filters and it does. Then an empty array tells you nothing was changed:
const { data, error } = await supabase
.from("notes")
.update({ body })
.eq("id", noteId)
.select();
if (error) throw error;
if (data.length === 0) {
throw new Error("Nothing was saved: the note was not found or you may not change it");
}The same works for .delete().eq("id", noteId).select(). Keep this check in the app after the fix too, so the next silent failure shows up as an error instead of a lost edit.
The five causes
1. There is no update or delete policy
With RLS on, every action is denied until a policy allows it. For insert you get an error. For update and delete, the row is simply left out. Many generated migrations add policies for select and insert only, so the app can read and create but every edit and delete quietly does nothing.
2. There is no select policy for the row
An update with a filter, such as .eq("id", noteId), has to read the row to find it. Postgres then applies the select policies too, in addition to the update policy. A table with an update policy and no matching select policy still changes nothing. The same holds for delete.
3. The policy does not match the row
The policy’s using condition is false for this row. Typical examples: the policy checks user_id, but the row was created by a server function that stored a different id; the policy checks the owner, but the user is a team member who should be allowed to edit; the row’s owner column is empty. The user can see the row through one policy, but no update policy lets them change it.
4. The filter matches nothing
The id is wrong, so no row would change even without RLS. Common in generated code: filtering by user_id with the profile’s id, using an id from another table, or a stale id after the row was recreated. If the same statement changes nothing in the SQL editor too, this is your cause.
5. The request is signed out
Without a session, the request runs as the anon role. Policies written to authenticated do not apply, so every row is hidden and nothing changes. Typical triggers: the update runs before supabase-js has restored the session after a page load, or the session expired. If your table has no grants for anon at all, you get permission denied for table instead.
How to fix it
Give the table one policy per action, each tied to the caller. This fixes causes 1 to 3 for an owner-only table:
create policy "Users can change their notes"
on public.notes for update to authenticated
using ((select auth.uid()) = user_id)
with check ((select auth.uid()) = user_id);
create policy "Users can delete their notes"
on public.notes for delete to authenticated
using ((select auth.uid()) = user_id);If other people should edit the row too, such as team members, the policy needs that rule, not a looser one. The RLS policy builder generates owner and team policies. For cause 4, log the id you filter by and compare it with the row in the Table Editor. For cause 5, wait for the session (supabase.auth.getSession() or the auth state listener) before writing.
In my Supabase app, .update() and .delete() on the table your_table return error: null, but nothing changes. Find the table’s policies in the migrations and every place in the code that updates or deletes its rows. Then fix it like this, in a new migration: make sure there is a select, an update and a delete policy for the authenticated role that allow the row only when (select auth.uid()) = the owner column (update needs both USING and WITH CHECK). If team members must edit rows, add a policy that checks team membership, not true. In the app code, chain .select() after every update and delete and treat an empty result as an error, and only run writes once a user is signed in.
Do not add policies with true, do not disable RLS, do not use the service role key in client code and do not edit existing migrations. Show me the migration and the code change before applying them.
Check that the fix works
In the SQL Editor, act as a signed-in user inside a transaction. Use a real user id from Authentication → Users and the id of one of their notes:
begin;
set local role authenticated;
set local request.jwt.claims = '{"sub": "11111111-1111-1111-1111-111111111111", "role": "authenticated"}';
update public.notes set body = 'Changed' where id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' returning id, body;
delete from public.notes where id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' returning id;
rollback;Before the fix, both statements return no row. After the fix, each returns the note. Then put in the id of another user’s note: both must return no row again, because users may only change their own notes. The rollback undoes everything. The guide to testing RLS policies has the full set of checks to run before launch, and if a select returns nothing as well, see Supabase query returns an empty array.
Frequently asked questions
Why does insert fail with an error, but update fails silently?
A new row is either allowed or refused, so Postgres reports a refused insert. For update and delete, row level security works like a filter: rows the user may not touch are left out, as if they did not exist, and the statement simply changes zero rows. Only the WITH CHECK side of an update policy raises an error.
Do I need a select policy to update a row?
Yes, as soon as the update has a filter like .eq(“id”, id), and it almost always does. Postgres then also applies the select policies to find the row. An update policy without a matching select policy changes nothing.
Why does the same update work in the SQL editor?
The SQL editor runs as the database owner, and row level security does not apply to the owner. Your app runs as the anon or authenticated role. Test as a user, as shown under Check that the fix works.
How do I know how many rows were changed?
Chain .select() after the filters. supabase-js then returns the changed rows in data, so data.length is the number of rows changed. Zero means the filter matched nothing or the policies hid the row.
Sources
- 1.CREATE POLICY — PostgreSQL Documentation
- 2.Row Security Policies — PostgreSQL Documentation
- 3.JavaScript: Update data — Supabase Docs
- 4.JavaScript: Delete data — Supabase Docs
- 5.Row Level Security — Supabase Docs