Azure PostgreSQL Flexible Server Backups Incompatible with pg_restore Directory Format
Issue Description
When attempting to restore Azure PostgreSQL Flexible Server backups using the pg_restore directory format (-Fd), the operation fails with the error pg_restore: error: could not open input file "./path/to/pgdump_format/toc.dat": No such file or directory
. This occurs because the backup files generated by Azure Backup Vault for PostgreSQL Flexible Server are not created in the proper PostgreSQL directory format expected by pg_restore.
Technical Details
- Issue: Azure PostgreSQL Flexible Server backup files lack the critical
toc.dat
file required for directory format restores - Environment: Azure Database for PostgreSQL Flexible Server using Azure Backup Vault
- Command Used:
pg_restore -h $SERVER -U $USER -d $DB -Fd -C --no-owner --no-privileges $PGDUMP_DIR
- Error:
pg_restore: error: could not open input file "./path/to/pgdump_format/toc.dat": No such file or directory
Investigation Findings
- Azure Backup Vault for PostgreSQL Flexible Server creates individual SQL dump files for each database, not a proper PostgreSQL directory format backup
- Files generated are plain SQL dumps, not the binary format with metadata that would be created by
pg_dump -Fd
- The Azure documentation suggests directory format should work, but the actual files don't support this approach
Workaround
Currently working around the issue by using individual SQL file restores for each database, but this is less efficient than a properly formatted directory restore would be.
Request
- Update Azure PostgreSQL Flexible Server backup to properly support directory format backups compatible with pg_restore -Fd
- Or, update documentation to clearly indicate this limitation and provide the correct restore approach
Impact
This issue affects automation scripts for disaster recovery scenarios where standard PostgreSQL restore tools are expected to work with Azure-generated backups.
Hub Issue Summary: Azure PostgreSQL Flexible Server Backups Incompatible with pg_restore Directory Format
Doc Reference: https://learn.microsoft.com/en-us/azure/backup/backup-azure-database-postgresql-flex-restore-cli