Safe logical backup on Supabase Free without the existing postgres password – Temporary Access vs CLI login role #54466
Replies: 3 comments 5 replies
Why not try supabase db dump --db-url postgres://postgres:sbp_111222333aaabbbccc@db.{project-ref}.supabase.co/postgres from the cli and see if it works? |
|
AI-assisted, not affiliated with Supabase. Based on current docs and the CLI v3.4.0 source; Suggested path: the backup guide's dump commands, targeting your project ref instead of a connection string. With no database password set, the CLI code creates a temporary login role, so no reset and no secret on the command line. Not run on a hosted project, and the guide requires Docker. supabase login
supabase db dump --remote=<PROJECT_REF> -f roles.sql --role-only
supabase db dump --remote=<PROJECT_REF> -f schema.sql
supabase db dump --remote=<PROJECT_REF> -f data.sql --use-copy --data-only -x "storage.buckets_vectors" -x "storage.vector_indexes"1. 17.6.1.127 meets the 17.6.1.081 minimum. Token access is off by default; enable Enforce SSL, then turn it on under Database Settings > Database access. Map your own user to 2. Shared-pooler connections are supported. On Free, use the Session pooler ( # Host from Connect > Session pooler. Paste the token at the "Password:" prompt.
# -n: list your own schemas. sslmode=verify-full + sslrootcert also verifies the server.
CONN="host=<SESSION_POOLER_HOST> port=5432 dbname=postgres user=postgres.<PROJECT_REF> sslmode=require options='-c jit=true'"
pg_dump -W --schema-only -n public -f schema.sql -d "$CONN"
pg_dump -W --data-only -n public -f data.sql -d "$CONN"
# Non-superusers can't read password hashes, hence --no-role-passwords
pg_dumpall -W --roles-only --no-role-passwords -f roles.sql -d "$CONN"3. 4. Restore into a disposable project with the guide's |
|
A route that avoids the token-access blockers above (SSL enforcement, member-role rules) and doesn't need the existing postgres password: create a separate read-only login role for the backup, then drop it afterwards. In the Dashboard SQL editor (you're the project owner): create role backup_reader with login password '<long random password>' bypassrls;
grant pg_read_all_data to backup_reader;
Then dump through the IPv4 Session pooler. Your 18.4 client can dump a 17 server. pg_dump -W "host=<SESSION_POOLER_HOST> port=5432 dbname=postgres user=backup_reader.<PROJECT_REF> sslmode=require" \
--no-owner --no-privileges | gzip > before-migration.sql.gzFor proof that it restores, load the file into a local Postgres 17 or 18 and compare row counts per table with the source. When you're done, run Two limits, as with any plain
(I build a small free CLI that does exactly this dump plus the restore-and-count check: https://github.com/SaschaHeyer/liferaft-cli. Run |
Uh oh!
There was an error while loading. Please reload this page.
Hello Supabase community,
We are preparing a safe logical backup of an existing managed Supabase project before an application migration.
Our environment:
The original postgres database password is currently unavailable. We would prefer to avoid resetting it because existing application connections may depend on it.
We have reviewed the Supabase CLI temporary login-role mechanism, but we would like to identify the simplest officially supported and secure backup workflow.
We also found the recently updated documentation for Temporary Access:
https://supabase.com/docs/guides/platform/temporary-access
Our questions are:
1. Temporary Access on the Free plan
Is the documented token-based Temporary Access feature available on the Free plan for PostgreSQL release 17.6.1.127?
Can an authorized project owner temporarily assume an existing database role without resetting the original postgres password?
2. Logical backup using Temporary Access
Can this authentication mechanism be used with native PostgreSQL tools such as pg_dump and pg_dumpall through the Session pooler?
Would this be a supported alternative to the CLI-generated temporary login role?
Are there any limitations regarding schema, data, custom roles, privileges, or restore compatibility?
3. Secure credential handling
Is there a supported workflow for supplying a short-lived access token through an interactive hidden password prompt or another secure, non-persistent mechanism?
We would like to avoid storing credentials in plaintext files, command-line arguments, shell history, or application logs.
4. Recommended backup procedure
For a Free-plan project, what is the recommended minimal procedure to obtain:
If Temporary Access is unsuitable for this purpose, is a controlled database password reset the recommended alternative?
We are looking for a supported, practical solution rather than modifying platform-managed objects or building a custom authentication system.
Official documentation, working examples, or experience with recent Supabase CLI versions would be greatly appreciated.
Thank you.
All reactions