mirror of
https://github.com/databasus/databasus.git
synced 2026-04-06 00:32:03 +02:00
feat(postgresql): Add schema filter for pg_dump and pg_restore #368
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @leonardocouy on 12/10/2025
Summary
Add an optional "Schemas" field to PostgreSQL database settings, allowing users to specify which schemas to include in backups and restores using a comma-separated list.
Motivation
When backing up managed PostgreSQL databases or databases with restricted internal schemas, the backup user may not have access to all schemas. This causes
pg_dumpto fail with permission errors like:By filtering backups to only include specific schemas (e.g.,
public), users can successfully backup their databases without permission errors.My use case was to back up only the public and drizzle schemas from the Supabase DB, because this one doesn't allow backing up other internal schemas.
Changes
Backend
schemascolumn topostgresql_databasestableSchemasfield toPostgresqlDatabasestructbuildPgDumpArgs()to append--schemaflagspg_restoreargs to support--schemafilteringFrontend
Usage
Setting the Schemas field to
public,custom_schemagenerates:Leave the field empty for full database backup/restore (default behavior).
Screenshots
Schema field with tooltip when configuring backup
Schema field with tooltip in restore modal
Testing
How to Test
If you'd like to test this feature, a pre-built Docker image is available:
Then run it with your preferred configuration or build locally or replace the image in your existing Postgresus deployment.