Skip to content
VibeSafeDaily

Exposed data

Supabase update says success but nothing changes, and the quick fix opens every row

Cataloged October 29, 2026 · Supabase · Lovable · Bolt · Cursor

Symptom

You click Save, or the app calls .update() or .delete(), and nothing comes back as an error. The screen says saved. Reload the page and the row is the same as before. A delete does the same: the row is still there. The usual fix from an AI coding tool is a policy written as using (true), or turning row level security off. That makes the button work by letting every user change every row.

Root cause

With row level security on, a using clause that filters a row out raises no error. The statement matches zero rows and finishes as a success. Supabase's row level security guide says only a missing grant or a with check violation raises 42501, while a using clause that filters the row out "raises nothing, matches zero rows". The same guide cautions: "To perform an UPDATE operation, a corresponding SELECT policy is required. Without a SELECT policy, the UPDATE operation will not work as expected." PostgreSQL's CREATE POLICY docs explain why. An UPDATE usually reads columns in the table it changes, in the WHERE clause your client sends (such as .eq('id', ...)), in RETURNING, or in the SET expression. That read needs SELECT rights, so the SELECT or ALL policies are applied in addition to the UPDATE policies. The user has to reach the row through a SELECT policy as well as an UPDATE policy. DELETE works the same way when the statement reads columns. In PostgREST discussion 2423, a maintainer showed that without a SELECT policy, .eq('id', 1) sees no rows, so the SQL result is UPDATE 0. Supabase maintainers confirmed the no-error, zero-rows behavior is expected. In supabase/supabase issue 1730, a fetch that row level security hides comes back as an empty array, not an error, because the policy acts like a WHERE clause. In pg_graphql issue 186, an update the policy filters out runs without an error and changes zero rows, the same as plain SQL, while breaking a with check does raise an error. An update policy needs both parts. using decides which existing rows can be changed. with check decides what the new row is allowed to look like, which stops a user from setting user_id to someone else. If with check is omitted, the using expression is used for both.

Before and after

The before policy is update-only. Supabase's guide says an update also needs a select policy, so this statement matches zero rows and returns no error. The after block adds a select policy with the same owner rule, and an update policy with both using and with check.

Before

create policy "users can update notes" on public.notes
  for update to authenticated
  using ((select auth.uid()) = user_id);

After

create policy "users read their own notes" on public.notes
  for select to authenticated
  using ((select auth.uid()) = user_id);

create policy "users update their own notes" on public.notes
  for update to authenticated
  using ((select auth.uid()) = user_id)
  with check ((select auth.uid()) = user_id);

Fix prompt

In this project only. Do not test against anyone else's app.

1. Find every table this app updates or deletes. Search for .update( and .delete( and write down the table at each call.

2. For each of those tables, list the select, update, and delete policies: the command, the role, the using expression, and with check. Read them from this project's migrations. If they are not in the repo, tell me to run this in my own SQL editor and paste the result back with no row data: select tablename, roles, cmd, policyname, qual, with_check from pg_policies where schemaname = 'public' order by tablename, cmd;

3. Where a table has an update or delete policy but no select or all policy for the same role and the same owner rule, add a select policy. Adapt the owner column:

create policy "users read their own rows"
on public.your_table
for select
to authenticated
using ((select auth.uid()) = user_id);

4. Give each of those tables an update policy with both halves. using decides which existing rows can change. with check decides what the new row may look like, so a user cannot point user_id at someone else:

create policy "users update their own rows"
on public.your_table
for update
to authenticated
using ((select auth.uid()) = user_id)
with check ((select auth.uid()) = user_id);

5. Give each of those tables a delete policy with using set to the same owner rule:

create policy "users delete their own rows"
on public.your_table
for delete
to authenticated
using ((select auth.uid()) = user_id);

6. Do not "fix" a silent update by writing using (true) or with check (true), by disabling row level security, or by switching browser code to the service role key. That key bypasses row level security and does not belong in the browser.

7. Make the client notice a write that changed nothing. After each .update() and .delete() that should affect a row, chain .select() and treat an empty array as a failure. Or use .single(), which errors when the result is not one row. Show that failure in the UI. Do not show Saved.

8. Put the new policies, and any grant the table is missing for the role that calls it, in one new migration. Do not edit migrations that have already been applied. Error 42501, permission denied for table, means a grant is missing. A success that changes zero rows is the policy, not the grant.

9. If users should never change the owner column, add this in the same migration, with the real table and column names: revoke update (user_id) on table public.your_table from anon, authenticated;

10. Tell me how to verify on my own app with two test accounts I own. As account A, save a change to A's row, reload, and confirm it stuck. As account B, try to update and delete A's row, and confirm the row is unchanged and the screen shows an error instead of Saved.

Do not print keys, tokens, or user data. Do not edit unrelated files.

Paste this into the coding tool that has your own project open.

2-minute self-check

These steps are for an app you own. Do not run them against someone else's project.

  1. In your own Supabase project's SQL editor, run select tablename, roles, cmd, policyname, qual, with_check from pg_policies where schemaname = 'public' order by tablename, cmd; A table with an UPDATE or DELETE policy and no SELECT or ALL policy for the same role is the case where a save can succeed and change nothing.
  2. In that same result, look for an UPDATE policy where with_check is null and qual is true. A null with_check means the using expression also controls the new row, and qual true means every row that role can see is writable. That is the quick fix that opens the table.
  3. In your own app, change a field on a row you own, save, and reload. The new value should still be there. If the old value is back and the screen said saved, the write matched zero rows.
  4. In your own code, search for .update( and .delete(. A call that only checks error, and never checks that the returned rows are non-empty or uses .single(), will treat a zero-row write as success.

Common questions

Why didn't Supabase return an error?

A using clause filters rows out. It does not reject the statement. Supabase's row level security guide says a missing grant or a with check violation raises 42501, and a using clause that filters the row out raises nothing and matches zero rows. supabase-js then has no error to show, so a screen that only checks error says saved. PostgREST discussion 2423 shows the same case: without a select policy, .eq('id', 1) sees no rows, and the database reports UPDATE 0.

Is using (true) on the update policy a safe fix?

No. using (true) lets every account the policy applies to change every row. Turning row level security off does that for the whole table. The save failed because the caller could not see the row, most often because there is no select policy with the same owner rule. Add that select policy, and write the update policy with both using and with check, for example (select auth.uid()) = user_id. Keep using (true) only on a table that is meant to be public, and only for select.

How do I make my app notice a write that did nothing?

Ask for the rows back. Chain .select() on the .update() or .delete() and treat an empty array as a failure, or call .single(), which errors unless exactly one row comes back. pg_graphql issue 186 says the database will not raise an error when a using clause filters the row out, so the check belongs in the client. Show that failure instead of Saved.

Sources

Same symptom

Same platform