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

Restoring pg_dump Backup with psql Fails

From: "Phillip Smith" <phillip(dot)smith(at)weatherbeeta(dot)com(dot)au>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Restoring pg_dump Backup with psql Fails
Date: 2007-12-29 00:27:25
Message-ID: 003501c849b1$95ed1200$9b0014ac@wbaus090 (view raw, whole thread or download thread mbox)
Lists: pgsql-admin
PostgreSQL 8.2.4 on RedHat ES4 64-bit

Hi all,

Doing some works on a database this morning (changing it to take data from
our new ERP system) so naturally I made a backup of the database first:
      pg_dump important_database > ~/backup/important-071229.sql
	chmod 440 ~/backup/important-071229.sql

Of course things have screwed up (fortunately no-one is working today) and I
need to restore:
	ALTER DATABASE important_database RENAME TO
	CREATE DATABASE important_database;
	psql important_database < ~/backup/important-071229.sql

But I get a whole bunch of errors, for example:
ERROR:  syntax error at or near "all"
LINE 1: all orders over $400.00 - freight free Order 10 of any produ...
ERROR:  syntax error at or near "If"
LINE 1: If stores spend over $300.00 they will receive a 5% discount...
invalid command \.
invalid command \.
invalid command \N
invalid command \N

Both psql and pg_dump are the correct versions:
	[postgres(at)stirling ~]$ ls -lh `which pg_dump`
	lrwxrwxrwx  1 root root 31 Jul 25 11:51 /usr/local/bin/pg_dump ->
	[postgres(at)stirling ~]$ ls -lh `which psql`
	lrwxrwxrwx  1 root root 28 Jul 25 11:51 /usr/local/bin/psql ->
(I compile each new version of Postgres to it's own folder and data dir:
/usr/local/pg-<version>/ and /home/Postgres/pgData-<version> )

What am I doing wrong?


Phillip Smith
IT Coordinator
Weatherbeeta P/L
8 Moncrief Rd
Nunawading, VIC, 3131

THINK BEFORE YOU PRINT - Save paper if you don't really need to print this

*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee.  If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments


pgsql-admin by date

Next:From: Tom LaneDate: 2007-12-29 02:26:06
Subject: Re: Restoring pg_dump Backup with psql Fails
Previous:From: Usama DarDate: 2007-12-28 22:40:02
Subject: Re: Fresh copy of a PG DB ?

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