0

I have exported a copy of my local Postgres DB from PhpPgMyAdmin and the resulted file is a pretty normal .sql which contains both the structure and the data of the DB.

Then I have tried to import this structure and data to a remote DB connected via PgAdmin4 but I am getting this message at the moment:

pg_restore: error: input file appears to be a text format dump. Please use psql.

I have tried to look for some file converter online to change the file format from .sql to .psql but I couldn't find any and anyway pgAdmin4 should accept .sql files which confuses me:

enter image description here

Any ideas?

Davide
  • 11
  • 5
  • This looks like PgAdmin4 uses `pg_restore` under the hood. You should use the `psql` client to restore from a plain .sql file. – clamp Dec 30 '19 at 23:08
  • this was answered here Davide I beleive: https://stackoverflow.com/questions/40632228/input-file-appears-to-be-a-text-format-dump-please-use-psql – zip Dec 30 '19 at 23:20
  • I am using the PgAdmin4 Browser interface for the import, not the terminal, so that other stackoverflow question does not answer my issue. What do you mean with "psql client"? – Davide Dec 31 '19 at 08:36
  • Found the sql query tool in PgAdmin4 and solved the issue. – Davide Dec 31 '19 at 08:57

1 Answers1

0

Issue solved. Under "Tool" select "Query Tool" and import your .sql file there.

For the query to be run I had to change the "OWNER" of the DB to the new "user" of the DB where I wanted to import the data.

Davide
  • 11
  • 5