I have a file db.backup
, that I would like to restore to PostgreSQL version 11.
When I tried to install via Azure Data Studio I got an error:
Restore: pg_restore: [archiver] unsupported version (1.13) in file header
Then I found that running pg_restore
I can actually read the file:
pg_restore /..db.backup -U postgres > db-restore.sql
And I can see that the file is human-readable. However I would much rather just restore the database from the backup.
How can I do this? I tried installing an older version of PostgreSQL server, but I don't know how to install an older version of PSQL (yet). Would this help?
Is there some flag I can add to the restore command so that the restore works?
— EDIT
The output of pg_restore --version
, i.e. the version of pg_restore
that gave me the error message mentioned above:
pg_restore (PostgreSQL) 11.4 (Ubuntu 11.4-1.pgdg18.04+1)
Best Answer
Version 1.13 of the pg_dump archive format was introduced in February 2018 as part of the changes for CVE-2018-1058. The version bump was mentioned in the commit message with a specific warning about the problem:
That was six months before PostgreSQL 11 was released, so an installation that supports PostgreSQL 11 is not supposed to use an older pg_restore. I'm not sure what exactly is "Azure Data Studio" in terms of the software stack it provides, but it looks like it has an outdated version of pg_restore that is not suitable for your needs.