From: Phillip Smith <phillip.smith@weatherbeeta.com.au>
To: pgsql-admin@postgresql.org
Subject: Restoring pg_dump Backup with psql Fails
Date: Sat, 29 Dec 2007 11:27:25 +1100
Message-ID: <003501c849b1$95ed1200$9b0014ac@wbaus090> (raw)
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:
psql
ALTER DATABASE important_database RENAME TO
important_database071229;
CREATE DATABASE important_database;
\q
psql important_database < ~/backup/important-071229.sql
But I get a whole bunch of errors, for example:
<snip>
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...
<snip>
invalid command \.
invalid command \.
invalid command \N
invalid command \N
<snip>
Both psql and pg_dump are the correct versions:
[postgres@stirling ~]$ ls -lh `which pg_dump`
lrwxrwxrwx 1 root root 31 Jul 25 11:51 /usr/local/bin/pg_dump ->
/usr/local/pg-8.2.4/bin/pg_dump
[postgres@stirling ~]$ ls -lh `which psql`
lrwxrwxrwx 1 root root 28 Jul 25 11:51 /usr/local/bin/psql ->
/usr/local/pg-8.2.4/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?
Cheers,
~p
Phillip Smith
IT Coordinator
Weatherbeeta P/L
8 Moncrief Rd
Nunawading, VIC, 3131
AUSTRALIA
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
e-mail.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: phillip.smith@weatherbeeta.com.au
Subject: Re: Restoring pg_dump Backup with psql Fails
In-Reply-To: <003501c849b1$95ed1200$9b0014ac@wbaus090>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox