Search code examples
postgresqlpgadminpgadmin-4

How to restore a tar file in postgres?


I am trying to restore a .tar file in pgadmin 4.

I created a new empty database exercises. Then clicked on exercises > create restore > select file path with data options as pre-data, data, post-data selected. While restoring it, I am getting an error. Screenshot for pgadmin4

Error description logs

Error Logs in plain text:

 C:\Program Files\PostgreSQL\16\pgAdmin 4\runtime\pg_restore.exe --host "localhost" --port "5432" --username "postgres" --no-password --dbname "exercises" --section=pre-data --section=data --section=post-data --verbose "C:\\Users\\Bhaskar\\DOWNLO~1\\EXERCI~1.TAR"

I have also tried to restore without any data options too.

How to resolve this error


Solution

  • It got resolved after doing the following steps

    Open up pgAdmin4 and go to:

    File > Preferences > Paths > Binary paths > PostgreSQL Binary Path
     > select the appropriate postgres version(you may not have the default version listed)
    > select the bin folder of the version selected and click validate > Click OK