I have a database to import, it is native to Postgre and has a .sql extension, I am trying to import it into PgAdmin4 but I can not do it at all. There is an image of the error.
Restoring using pg_restore
, which is what PGAdmin is using does not support sql files, since it is necessary to have generated backup format files.
To use the sql file, you can open the pgadmin console and choose Open > File, select the sql and then trigger the Run action.
The best option, however, is to use psql (command line). Preferably in the same directory of the file, to avoid having to write the file path:
psql -h nomeservidor -U nomeusuario -d nomebancodedados < /caminho/nomearquivo.sql
or
psql -h nomeservidor -U nomeusuario -d nomebancodedados < nomearquivo.sql
To get more assurance, you can connect to the server and call the file after connected:
1) Connect: psql -h nomeservidor -U nomeusuario -d nomebancodedados
2) Executing the file: \i nomedoarquivo