`ERROR: column "public" of relation "buckets" does not exist (SQLSTATE 42703)` During `supabase db reset`
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 storage.buckets (id, name, public)
values
('public', 'public', 'TRUE'),
('private', 'private', 'FALSE');
I then upgraded to v1.75.3 and the following error began presenting itself:
Applying migration 20230420235920_buckets.sql...
ERROR: column "public" of relation "buckets" does not exist (SQLSTATE 42703)
At statement 0: insert into storage.buckets (id, name, public)
values
('public', 'public', 'TRUE'),
('private', 'private', 'FALSE')
Try rerunning the command with --debug to troubleshoot the error.
I tried running the exact same query in an empty project, using v1.75.3, without any migrations, once supabase db reset finished (from the web UI's SQL Editor) and get no errors (Success. 0 rows returned).
To Reproduce Steps to reproduce the behavior:
- Create a new supabase project without any migrations
cd ~ && mkdir supabase-bug-test
cd supabase-bug-test
supabase init && supabase start
- Create a new migration:
supabase migration new buckets
- Add the following to the newly created migration:
-- supabase/migrations/..._buckets.sql
insert into storage.buckets (id, name, public)
values
('public', 'public', 'TRUE'),
('private', 'private', 'FALSE');
- Attempt to reset the database (
supabase db reset)
Expected behavior The database should not be throwing the error (indeed, it worked all the way to, at least, v1.68.6 and broke somewhere between v1.75.3)
Desktop (please complete the following information):
- OS: Mac OS 13.3 (22E252)
- Version of CLI:
- v1.68.6 (no error)
- v1.75.3 (error)
Edit: current workaround is downgrading back to 1.68.6:
brew tap-new supabase/local-tap
brew extract --version=1.68.6 supabase/tap/supabase supabase/local-tap
brew install [email protected]
supabase -v
Can you try supabase stop --no-backup before running supabase start? This flag cleans up any db volumes leftover from previous runs to ensure a clean start.
I can't seem to reproduce on a clean start.
@sweatybridge I tried your suggestion, and running supabase stop --no-backup followed by supabase start manages to reset everything fine, however I am still getting the exact same issue when I try and run supabase db reset.
Here's the output:
nrb@nrb-mbp inspire-tms-frontend % supabase stop --no-backup
Stopped supabase local development setup.
nrb@nrb-mbp inspire-tms-frontend % supabase start
Applying migration 20230420161043_diff.sql...
Applying migration 20230420174112_diff.sql...
Applying migration 20230420184424_diff.sql...
Applying migration 20230420225315_diff.sql...
Applying migration 20230420230056_diff.sql...
Applying migration 20230420231240_diff.sql...
Applying migration 20230420231424_diff.sql...
Applying migration 20230420231755_diff.sql...
Applying migration 20230420235920_buckets.sql...
Applying migration 20230421000801_diff.sql...
Applying migration 20230421010505_diff.sql...
...
Applying migration 20230704003913_diff.sql...
Applying migration 20230704004639_diff.sql...
Applying migration 20230704004651_create_public_profiles_picture_folder.sql...
Applying migration 20230704013509_allow_users_to_create_company_private_folder.sql...
Seeding data supabase/seed.sql...
Started supabase local development setup.
API URL: http://localhost:54321
GraphQL URL: http://localhost:54321/graphql/v1
DB URL: postgresql://postgres:postgres@localhost:54322/postgres
Studio URL: http://localhost:54323
Inbucket URL: http://localhost:54324
JWT secret: super-secret-jwt-token-with-at-least-32-characters-long
anon key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
service_role key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
nrb@nrb-mbp inspire-tms-frontend % supabase db reset
Resetting local database...
Restarting containers...
Applying migration 20230420161043_diff.sql...
Applying migration 20230420174112_diff.sql...
Applying migration 20230420184424_diff.sql...
Applying migration 20230420225315_diff.sql...
Applying migration 20230420230056_diff.sql...
Applying migration 20230420231240_diff.sql...
Applying migration 20230420231424_diff.sql...
Applying migration 20230420231755_diff.sql...
Applying migration 20230420235920_buckets.sql...
ERROR: column "public" of relation "buckets" does not exist (SQLSTATE 42703)
At statement 0: insert into storage.buckets (id, name, public)
values
('public', 'public', 'TRUE'),
('private', 'private', 'FALSE')
Try rerunning the command with --debug to troubleshoot the error.
Thank you for clarifying. I managed to reproduce and will release a fix soon.
Thanks for the quick turn-around @sweatybridge !
@sweatybridge It seems tlike there's a regression and #1278 got reverted in v2.x for some reason as I currently have the exact same problem as described above with the latest version of the CLI
Apparently @AbdullahAhmadAAK had the same problem a few months ago with supabase/supabase#29804, but that one got closed by @Hallidayo due to inactivity
I would be happy to contribute a fix, but I'm not familiar with Go as a language unfortunately, so I'm hoping this one can get resolved by somebody from the supabase team 🙏
@MichaelDeBoey I had the same issue. Upgrading the supabase cli from 2.31.8 to 2.45.5 resolved it
I'm seeing the same issue today:
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.
❯ which supabase /opt/homebrew/bin/supabase ❯ supabase --version 2.45.5
SAME
ERROR: column "public" of relation "buckets" does not exist (SQLSTATE 42703)
At statement: 0
-- Create a new bucket called 'avatars' with appropriate settings
insert into storage.buckets (id, name, public, file_size_limit, allowed_mime_types)
which supabase /opt/homebrew/bin/supabase
supabase --version 2.45.5
Yep me too on 2.45.5
We are also having problems on 2.45.5 as well.
ERROR: column "public" of relation "buckets" does not exist (SQLSTATE 42703)
Hi- I think I'm experiencing something similar:
ERROR: function storage.enforce_bucket_name_length() does not exist (SQLSTATE 42883) At statement: 221 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()
also 2.45.5
Also experiencing this issue on version 2.45.5 of the CLI
Has anyone got a workaround?
hey yes, main branch of the cli repo has the fix
you can compile the binary yourself with go build -o supabase ., and just use it with any sub command e.g. ./supabase start
hopefully devs publish the latest soon
Thanks for digging @kaiba42, I did that and set up a supabase-custom alias. All working and I'm unblocked
2.45.5
same with me
I believe supabase@beta fixes this.