SupabaseS
Supabase2mo ago
ngiam

ERROR: 42501: must be owner of table objects

Tried to run the following in SQL Editor and i get the following error: Error: Failed to run sql query: ERROR: 42501: must be owner of table objects

I'm the only owner of the organization & project. What can I do to make this work?

Thank you!

-------------------------

-- Add _org_id computed column to storage.objects for org scoping
-- Date: 2025-11-11 (isolated migration)

-- Add the computed column if it doesn't exist
ALTER TABLE storage.objects
ADD COLUMN IF NOT EXISTS _org_id text GENERATED ALWAYS AS (split_part(name, '/', 2)) STORED;

-- Add index for faster queries on _org_id
CREATE INDEX IF NOT EXISTS idx_objects_org_id ON storage.objects (_org_id);

-- Ensure RLS is enabled on storage.objects
ALTER TABLE storage.objects ENABLE ROW LEVEL SECURITY;

-- Optional: Verify the change (this will log in the query output)
DO $$ BEGIN
RAISE NOTICE 'Added _org_id column and index to storage.objects';
END $$;
Was this page helpful?