简体   繁体   中英

pg_restore: [archiver] input file does not appear to be a valid archive error in PostgreSQL using Pgadmin 4

I am trying to open a SQL Script of PostgreSQL (.sql file) that contains the Create Database and INSERT statements but when I try to restore the database using PgAdmin 4 it gives me error stating "pg_restore: [archiver] input file does not appear to be a valid archive" . I selected the following fields in the Restore Database dialog box:

Format - as Custom or tar

Filename - C:\\Users\\parwa\\Desktop\\DWBI\\Assignment - 2(Chinook SQL - 2)\\Question Content\\Chinook_PostgreSql.sql

Number of Jobs - (left this field blank)

Role name - Postgres

I am not sure why it's giving me this error. Any help regarding this will be greatly appreciated. Thanks!

In pgAdmin 4 the Restore Dialog is a UI interface to the pg_restore command line utility ( https://www.postgresql.org/docs/9.2/static/app-pgrestore.html ), I don't think it deals with sql files directly.

The documentation says

You can use the Query Tool to play back the script created during a plain-text backup made with the Backup dialog. For more information about backing up or restoring, please refer to the documentation for pg_dump or pg_restore.

Which indicates that to restore the sql file you have you need to use the Query Tool instead.

Tools -> Query Tool and you can open or paste the file in there and run it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM