Skip to content

PostgreSQL backup fails when the database name contains spaces or special characters #910

Description

@plucik

Description

Creating a backup fails when the PostgreSQL database name contains spaces or special characters.

For example, a backup of the following database fails:

pgManage QA! DB

The generated pg_dump command works when executed directly in a system terminal, but it does not work when executed by pgManage.

Steps to reproduce

  1. Create a PostgreSQL database with a name containing spaces or special characters, for example:
CREATE DATABASE "pgManage QA! DB";
  1. Add or open a connection to this database in pgManage.
  2. Open the Backup tab.
  3. Select the custom backup format.
  4. Select a valid writable output location.
  5. Start the backup.

Observed result

The backup fails with an error similar to:

[Errno 30] Read-only file system: 'DB'

The generated command is similar to:

/usr/lib/postgresql/16/bin/pg_dump \
  --file "../storage/1/asd-backup" \
  --host "127.0.0.1" \
  --port "5432" \
  --username "postgres" \
  --no-password \
  --verbose \
  --role "pgmanage_test_admin" \
  --format=c \
  --blobs \
  --dbname "pgManage QA! DB"

Running the same command directly in a system terminal completes successfully.

Expected result

pgManage should pass the complete database name to pg_dump as a single argument.

Databases with spaces, punctuation, mixed case, or other characters requiring quoting should be backed up successfully.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions