Supabase “must be owner of table objects” – what it means and what to run instead

By Abheesht Tripathi · Published

ERROR: 42501: must be owner of table objects

What it means

storage.objects belongs to an internal Supabase role (supabase_storage_admin), not to the postgres role you use in the SQL Editor and in migrations. Statements that need table ownership, such as ALTER TABLE storage.objects ..., are refused.

Why you hit it

Most often from an old tutorial or a generated migration that starts with:

alter table storage.objects enable row level security;

You don't need that line. Row Level Security is already enabled on storage.objects in Supabase projects. Delete it and keep the policies.

What works instead

Creating, changing and dropping policies on storage tables is allowed for postgres, even though it doesn't own them. Run the policy on its own:

create policy "users read own files" on storage.objects
  for select to authenticated
  using (
    bucket_id = 'documents'
    and (storage.foldername(name))[1] = (select auth.uid())::text
  );

Need a hard block, for example no deletes from one bucket whatever other policies say? Use a restrictive policy, which is ANDed with all the others:

create policy "no deletes in seller-documents" on storage.objects
  as restrictive
  for delete to authenticated
  using (bucket_id <> 'seller-documents');

In the dashboard, the Database → Policies editor lets you choose Permissive or Restrictive; the Storage policy editor doesn't, so for storage.objects use the SQL Editor or a migration.

Check what's there

select policyname, cmd, permissive, roles, qual, with_check
from pg_policies
where schemaname = 'storage' and tablename = 'objects'
order by cmd, policyname;

A restrictive policy shows RESTRICTIVE in the permissive column.

The same error on auth tables

“must be owner of table users” is the same thing for auth.users. Don't alter auth tables; keep your own columns in a public.profiles table keyed by the user id.

Related guides

More in Supabase RLS and Storage · all guides