Skip site navigation (1) Skip section navigation (2)

Re: How to load a dump file into a DB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Vargas <davidvargasmoya(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to load a dump file into a DB
Date: 2010-07-29 03:31:50
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
David Vargas <davidvargasmoya(at)gmail(dot)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

In response to

pgsql-novice by date

Next:From: Arvind SharmaDate: 2010-07-29 05:45:11
Subject: Re: How to load a dump file into a DB
Previous:From: David VargasDate: 2010-07-29 00:40:54
Subject: How to load a dump file into a DB

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group