Supabase Error: ERROR: column "public" of relation "buckets" does not exist

We're seeing a strange error after upgrading our npm supabase package from v2.40.1 to v2.45.5 (for compliance reasons). Our CI is broken and we're unable to proceed work. We cannot run supabase locally.
Applying migration 20250320010804_add_file_hash_sync_local_remote.sql...
Applying migration 20250321022805_storage_bucket_creation_and_rls.sql...
Stopping containers...
ERROR: column "public" of relation "buckets" does not exist (SQLSTATE 42703)
At statement: 0
-- Create the migration-blobs bucket
insert into storage.buckets
(id, name, public, file_size_limit)
^
Try rerunning the command with --debug to troubleshoot the error.
Applying migration 20250320010804_add_file_hash_sync_local_remote.sql...
Applying migration 20250321022805_storage_bucket_creation_and_rls.sql...
Stopping containers...
ERROR: column "public" of relation "buckets" does not exist (SQLSTATE 42703)
At statement: 0
-- Create the migration-blobs bucket
insert into storage.buckets
(id, name, public, file_size_limit)
^
Try rerunning the command with --debug to troubleshoot the error.
We have previous db migrations such as 20250321022805_storage_bucket_creation_and_rls.sql:
-- Create the migration-blobs bucket
insert into storage.buckets
(id, name, public, file_size_limit)
select *
from ( values ('migration-blobs', 'migration-blobs', false, 5368709120) ) as data(id, name, public, file_size_limit)
where not exists (select 1
from storage.buckets
where id = data.id);
-- Create the migration-blobs bucket
insert into storage.buckets
(id, name, public, file_size_limit)
select *
from ( values ('migration-blobs', 'migration-blobs', false, 5368709120) ) as data(id, name, public, file_size_limit)
where not exists (select 1
from storage.buckets
where id = data.id);
What do we do? What version of supabase is the hosted version running so we can match that version locally?
17 Replies
ihm40
ihm404w ago
did you run supabase db reset after a migration. or did you just do supabase start The former will delete schema changes not contained within migrations so if you are going to run it, do so cautiously i'm not sure why it is complaining about the public column. I think that column has been there for a while
Grant
GrantOP4w ago
We can't even start the local db to reset because it won't start due to this migration issue. We ran supabase db reset
Grant
GrantOP4w ago
We have 112 db migrations. Here's the full command that is failing (running supabase start):
Grant
GrantOP4w ago
Where 20250321022805_storage_bucket_creation_and_rls.sql has something like:
-- Create the migration-blobs bucket
insert into storage.buckets
(id, name, public, file_size_limit)
select *
from ( values ('migration-blobs', 'migration-blobs', false, 5368709120) ) as data(id, name, public, file_size_limit)
where not exists (select 1
from storage.buckets
where id = data.id);
...
-- Create the migration-blobs bucket
insert into storage.buckets
(id, name, public, file_size_limit)
select *
from ( values ('migration-blobs', 'migration-blobs', false, 5368709120) ) as data(id, name, public, file_size_limit)
where not exists (select 1
from storage.buckets
where id = data.id);
...
I mean, this is HUGE if Supabase is changing the schema for tables in different versions
garyaustin
garyaustin4w ago
The schemas change constantly in auth/storage/realtime.
Grant
GrantOP4w ago
public looks like a field in the latest storage.buckets
create table storage.buckets (
id text not null,
name text not null,
owner uuid null,
created_at timestamp with time zone null default now(),
updated_at timestamp with time zone null default now(),
public boolean null default false,
avif_autodetection boolean null default false,
file_size_limit bigint null,
allowed_mime_types text[] null,
owner_id text null,
type storage.buckettype not null default 'STANDARD'::storage.buckettype,
constraint buckets_pkey primary key (id)
) TABLESPACE pg_default;

create unique INDEX IF not exists bname on storage.buckets using btree (name) TABLESPACE pg_default;

create trigger enforce_bucket_name_length_trigger BEFORE INSERT
or
update OF name on storage.buckets for EACH row
execute FUNCTION storage.enforce_bucket_name_length ();
create table storage.buckets (
id text not null,
name text not null,
owner uuid null,
created_at timestamp with time zone null default now(),
updated_at timestamp with time zone null default now(),
public boolean null default false,
avif_autodetection boolean null default false,
file_size_limit bigint null,
allowed_mime_types text[] null,
owner_id text null,
type storage.buckettype not null default 'STANDARD'::storage.buckettype,
constraint buckets_pkey primary key (id)
) TABLESPACE pg_default;

create unique INDEX IF not exists bname on storage.buckets using btree (name) TABLESPACE pg_default;

create trigger enforce_bucket_name_length_trigger BEFORE INSERT
or
update OF name on storage.buckets for EACH row
execute FUNCTION storage.enforce_bucket_name_length ();
garyaustin
garyaustin4w ago
Public was added to the schema 2 years ago. So something is wiping your storage schema. https://github.com/supabase/storage/blob/master/migrations/tenant/0008-add-public-to-buckets.sql
Grant
GrantOP4w ago
hmm, then ERROR: column "public" of relation "buckets" does not exist (SQLSTATE 42703) is very odd then.
garyaustin
garyaustin4w ago
I was just answering your question on schemas changing and the public column specifically. I don't know what is going wrong for you.
Grant
GrantOP4w ago
yes, acknowledged Still not sure what the error is, but I'm seeing 2 (1, 2) other customer +1s on 2.45.5. Have you seen any other report of this on your side?
garyaustin
garyaustin4w ago
Not sure what your side means. If you are talking Discord. There are numerous discussions involving these types of things with migrations and Supabase schemas and they occur off and on all the time. Most thought are getting out of sync between local and hosted versions. This is a user helping user forum so if there is a bug won't be resolved here.
That CLI issue seems like a good place to pursue it.
Richard
Richard4w ago
This is a big issue for us too. There are numerous new comments on this https://github.com/supabase/cli/issues/1277 in the last hours. It seems like user defined db migrations are executed before the built in schemas are finalized (specifically for storage).
GitHub
`ERROR: column "public" of relation "buckets" does not exist (SQLST...
Describe the bug I was previously using v1.68.6 of the cli, and had no problem running migrations that included, among other things: -- supabase/migrations/20230420235920_buckets.sql insert into st...
garyaustin
garyaustin4w ago
Might I suggest one of you open a new issue as that one is closed and might have been something different at the time. I've not looked over there yet other than to see the date and that it is closed. You could also start support requests. I've bumped a CLI dev to that github issue. No idea on his status or if or when he will see it though so you should still consider a new issue so other devs might notice.
Grant
GrantOP4w ago
Support request was: SU-254337 Qiao Han, Supabase engineer provided a fix in beta.
garyaustin
garyaustin4w ago
He is the one I contacted.
Grant
GrantOP4w ago
Thanks
vick
vick3w ago
I just ran into this issue as well. Reading that issue 1277 gave me the clue to update the supabase CLI to the latest (from v2.40.7 to v2.48.3) and somehow that seems to have fixed it. https://discord.com/channels/839993398554656828/1423374882296827954

Did you find this page helpful?