Postgresql – Issue working with Postgres on Windows

linuxpgadminpostgresqlpostgresql-9.3windows

I am running PostgreSQL 9.3 on my machine. I have PhpPgAdmin running on a cloud, using which I exported the database I am supposed to be working on, selecting "Structure and Data" and "Download". There is an sql file generated. On my machine however, I open my PgAdmin3 client , initialize my databases and run the following import command

psql -U postgres -d postgres -f dump.sql

Nothing happens. I also tried

psql postgres < /path/to/dump.sql 

But again nothing happens. I tried on both Windows as well as Linux Mint because I thought it was something wrong with my installation on Windows.
I am new to PostgreSQL and the equivalent for it in MySQL using PhpMyAdmin was simple. Am I missing any security things? I think not because just so that nothing gets confused, I saved all my names as postgres itself.

I have researched everywhere but nothing so far. Any help would be appreciated. Thanks!

Best Answer

The PSQL Console in pgadmin3 consists of opening a terminal and running psql --username yourname [other options] dbname inside it for you, with yourname and dbname being taken from what you've used to log in pgadmin3.

This console runs the psql interpreter which expects either psql meta-commands starting with backslash, or plain SQL commands.

When typing this:

`psql -U postgres -d postgres -f dump.sql`

it's taken as an unfinished SQL sentence for the interpreter, so it's just waiting for the rest. That's why nothing happens as you wrote. This command is out of context.

What you want is:

\i /path/to/dump.sql

\i means 'include' and is the meta-command to feed a file as a stream of SQL commands to the interpreter. You'll see the output of these commands on the terminal and when finished , type \q to end the session.