Error importing Postgre bank

Asked

Viewed 1,473 times

1

I have a bank to import, it’s native to Postgresql and is with extension .sql, I’m trying to care in the PgAdmin4 but I can’t do it at all. There’s a picture of the error.

inserir a descrição da imagem aqui

1 answer

3

The restoration using pg_restore, which is what is being used by Pgadmin does not support sql files as it is necessary to have backup format files generated.

To use the sql file, you can open the pgadmin console and choose from the menu the option Open > File, select the sql and then launch the Run action.

The best option, however, is to use psql (command line). Preferably in the same file directory, 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

For more assurance, you can connect to the server and call the file after connected:

1) Connect: psql -h nomeservidor -U nomeusuario -d nomebancodedados

2) Running the file: \i nomedoarquivo

  • When I use this command nothing happens, it comes back for me to enter commands again.

  • I solved the problem with the following command:.

  • That. That’s another option. I edited the solution to include this. Probably you did not get in the initials because the file path in Windows format is different than what I indicated.

  • Thanks friend.

  • Just one more thing: Which way do I put the file so I don’t have to put the path? I use windows10

  • You just don’t have to put his way if you run the psql in the same directory the file is in.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.