1

Using the pgAdmin4 and attempting to restore a .sql file through the GUI for local use.

I'm presented with the error: pg_restore: [archiver] input file appears to be a text format dump. Please use psql.

I'm failing to understand why this is the case when the file has a .sql extension - is there anyway to convert this file to psql as the error message suggests?

The file is viewable here: https://github.com/datacamp/courses-intro-to-sql/tree/master/datasets

Jim Jones
  • 18,404
  • 3
  • 35
  • 44
user1554264
  • 1,204
  • 3
  • 22
  • 47
  • psql isn't a format, but a client. Try executing it in your console `psql dbname < films.sql`. See more at https://www.postgresql.org/docs/9.1/static/backup-dump.html#BACKUP-DUMP-RESTORE: – Jim Jones Feb 27 '18 at 15:42

1 Answers1

3

The error message says, that you can't restore the file using pg_restore because, as you mentioned, it's simply a SQL file.

The suggested tool, psql, is used to execute random sql, and can be also fed an SQL file via stdin or as a parameter.

What you probably want to do, is just copy paste the content of the file (sql file is simply a text file) into the editor within pgAdmin to execute it. Possible that you can even directly open the sql file within pgAdmin.

peter
  • 14,348
  • 9
  • 62
  • 96