© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
7 replies
pocin

how to pg_restore a supabase db

I am about to deploy a large number of migrations. Before doing that i would like to test them one more time against prod database but on localhost.

I have
pg_dumpall
pg_dumpall
my prod instance.
Running
supabase start
pg_restore -cC -d postgres -e ./postgres.custom
supabase start
pg_restore -cC -d postgres -e ./postgres.custom

gives
pg_restore: from TOC entry 3540; 1262 12974 DATABASE postgres postgres
pg_restore: error: could not execute query: ERROR:  cannot drop the currently open database
pg_restore: from TOC entry 3540; 1262 12974 DATABASE postgres postgres
pg_restore: error: could not execute query: ERROR:  cannot drop the currently open database

When i
psql
psql
and
create database temp;
\c temp;
drop database postgres with (force);
create database temp;
\c temp;
drop database postgres with (force);

I get
ERROR:  database "postgres" is used by an active logical replication slot
DETAIL:  There is 1 active slot.
ERROR:  database "postgres" is used by an active logical replication slot
DETAIL:  There is 1 active slot.

but
pg_subscription
pg_subscription
is empty.

How can i restore a database from a backup?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Supabase-DB Backup and Restore
SupabaseSSupabase / help-and-questions
8mo ago
How to cleanly restore binary dump using pg_restore?
SupabaseSSupabase / help-and-questions
7mo ago
supabase db reset: problems with pg_cron
SupabaseSSupabase / help-and-questions
14mo ago
pg_dump and pg_restore between projects
SupabaseSSupabase / help-and-questions
3y ago