Re: How to load a dump file into a DB - Mailing list pgsql-novice

From Tom Lane
Subject Re: How to load a dump file into a DB
Date
Msg-id 250.1280374310@sss.pgh.pa.us
Whole thread Raw
In response to How to load a dump file into a DB  (David Vargas <davidvargasmoya@gmail.com>)
List pgsql-novice
David Vargas <davidvargasmoya@gmail.com> writes:
> I need to load a pgdump.sql file into a new Postgres db, but I'm totally not
> being able to do it. I am no programmer, I have installed the latest
> Postgres version for Windows, run the server, open psql. According to the
> pg_dump documentation, I should just run the command "$ psql -d newdb -f
> db.sql" into psql, but when I do it, nothing seems to be happening, I just
> get a new "postgres=#" line right away. I did change the db and file names
> to my names.

It sounds like you're confusing shell commands with psql commands.
This is something you'd type at the shell prompt:

    psql -d newdb -f db.sql

That tells the shell to fire up psql, and then psql will connect to
database "newdb" and execute the commands in file "db.sql".  But if
you're getting a "postgres=#" prompt then you must have executed psql
interactively, probably via a shell command like

    psql newdb

Now, you can do it from here too, but the command that psql takes
to read a file from interactive mode is

    \i db.sql

(think "include" for \i).

            regards, tom lane

pgsql-novice by date:

Previous
From: John DeSoi
Date:
Subject: Re: Which CMS/ecommerce/shopping cart works with Postgres ?
Next
From: Arvind Sharma
Date:
Subject: Re: How to load a dump file into a DB