0

I am trying to restore the backup file to PostgreSQL DB by;

pg_restore -d db_name -U user_name -C backup.dmp

However, I get this error when I executed this command.

pg_restore: [archiver] unsupported version (1.14) in file header

The version of the PostgreSQL DB I'm using is 11.6 (Ubuntu 11.6-1.pgdg18.04+1)

I assumed I need to upgrade PostgreSQL DB so I tried this command on the server.

brew upgrade postgresql

However, I get this error this time..

Error: postgresql not installed

I would appreciate any help or advice. Thank you very much.

Akihero3
  • 365
  • 5
  • 12

1 Answers1

1

It sounds like you are trying to work with a dump file that was created on a Mac, and you are trying to restore it on another machine (or the other way around?). brew is a Mac package manager. The equivalent for Ubuntu is apt. To install Postgres on Ubuntu, please follow the steps on the Ubuntu page of the PostgreSQL website. To upgrade, you should be able to do apt-get upgrade.

You may also not be able to brew upgrade postgresql on your Mac because Postgres may have been installed in another way (you may want to use Spotlight to find out whether your pg_dump lives in some .../Cellar/... folder or a .../Postgres.app/... folder (or some other folder), and perform your upgrade accordingly.

In either case, it seems you are encountering this archiver error message because of a missing security patch

richyen
  • 8,114
  • 4
  • 13
  • 28
  • Thank you very much for your answer. I saw the guy asked similar question here and answer was using so I was using it blindly.. I made dump file on Ubuntu and also try to restore it on Ubuntu. I managed to get upgrade with apt-get and now I get this error. `pg_restore: error: could not execute query: ERROR: relation "data" already exists` It seems file header error is gone at least :) – Akihero3 Dec 15 '19 at 17:32
  • Great! Your current error means that there is already a `data` table in your database. You need to either rename it or drop it before attempting to restore the dump – richyen Dec 15 '19 at 21:53