pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedRestoring pg_dump Backup with psql Fails
8+ messages / 3 participants
[nested] [flat]
* Restoring pg_dump Backup with psql Fails
@ 2007-12-29 00:27 Phillip Smith <phillip.smith@weatherbeeta.com.au>
0 siblings, 1 reply; 8+ messages in thread
From: Phillip Smith @ 2007-12-29 00:27 UTC (permalink / raw)
To: 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:
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.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Restoring pg_dump Backup with psql Fails
@ 2007-12-29 02:26 Tom Lane <tgl@sss.pgh.pa.us>
parent: Phillip Smith <phillip.smith@weatherbeeta.com.au>
0 siblings, 1 reply; 8+ messages in thread
From: Tom Lane @ 2007-12-29 02:26 UTC (permalink / raw)
To: Phillip Smith <phillip.smith@weatherbeeta.com.au>; +Cc: pgsql-admin
"Phillip Smith" <phillip.smith@weatherbeeta.com.au> writes:
> 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...
> ^
Please show us the *first* few errors, not some randomly chosen ones.
The above looks like a COPY has failed and psql has started thinking
that copy-data lines are commands, but how or why that happened is
not in evidence.
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Restoring pg_dump Backup with psql Fails
@ 2007-12-29 03:48 Phillip Smith <phillip.smith@weatherbeeta.com.au>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 8+ messages in thread
From: Phillip Smith @ 2007-12-29 03:48 UTC (permalink / raw)
To: 'Tom Lane' <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin
Sorry Tom - I should know better :)
I've attached the first 512 lines of the output from psql. The whole output
is 3mb.
Cheers,
~p
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Saturday, 29 December 2007 13:26
> To: Phillip Smith
> Cc: pgsql-admin@postgresql.org
> Subject: Re: [ADMIN] Restoring pg_dump Backup with psql Fails
>
> "Phillip Smith" <phillip.smith@weatherbeeta.com.au> writes:
> > 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...
> > ^
>
> Please show us the *first* few errors, not some randomly chosen ones.
> The above looks like a COPY has failed and psql has started thinking
> that copy-data lines are commands, but how or why that happened is
> not in evidence.
>
> regards, tom lane
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.
Attachments:
errors-short.txt (text/plain, 13.1K) download
SET
SET
SET
SET
SET
COMMENT
CREATE LANGUAGE
SET
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
CREATE FUNCTION
ALTER FUNCTION
CREATE FUNCTION
ALTER FUNCTION
CREATE FUNCTION
ALTER FUNCTION
CREATE FUNCTION
ALTER FUNCTION
CREATE FUNCTION
ALTER FUNCTION
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
CREATE FUNCTION
ALTER FUNCTION
COMMENT
SET
SET
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
SET
CREATE TABLE
ALTER TABLE
COMMENT
CREATE SEQUENCE
ALTER TABLE
setval
--------
1
(1 row)
SET
CREATE TABLE
ALTER TABLE
COMMENT
CREATE VIEW
ALTER TABLE
CREATE VIEW
ALTER TABLE
ERROR: relation "grps" already exists
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
COMMENT
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
SET
CREATE TABLE
ALTER TABLE
SET
CREATE TABLE
ALTER TABLE
COMMENT
ERROR: relation "stock" already exists
ALTER TABLE
COMMENT
COMMENT
ERROR: column "wholesale" of relation "stock" does not exist
ERROR: column "discount" of relation "stock" does not exist
ERROR: column "hl_wholesale" of relation "stock" does not exist
ERROR: column "tax_rate" of relation "stock" does not exist
CREATE TABLE
ALTER TABLE
COMMENT
ERROR: column s.supplier_code does not exist
LINE 2: ... g.category, s.grp, s.brand, s.style, s.supplier, s.supplier...
^
ERROR: relation "public.stock_full_detail" does not exist
CREATE TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
CREATE TABLE
ALTER TABLE
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
COMMENT
ERROR: invalid byte sequence for encoding "UTF8": 0x96
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
CONTEXT: COPY dwh_cust, line 7413
ERROR: invalid byte sequence for encoding "UTF8": 0xe86d65
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
CONTEXT: COPY dwh_stk, line 323461
ERROR: column "use_barcodes" of relation "grps" does not exist
invalid command \
invalid command \
Query buffer reset (cleared).
invalid command \nOrders
Query buffer reset (cleared).
invalid command \n
Query buffer reset (cleared).
invalid command \n
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-02 13:16:53.246734+10 28qgb1b6qv7kckgbj2gd2at626 roc...
^
ERROR: syntax error at or near "ID"
LINE 1: ID=52a2e4941b1b10e7a8575a39fc50f184 true [[B]]
^
ERROR: syntax error at or near "ID"
LINE 1: ID=52a2e4941b1b10e7a8575a39fc50f184 true [[B]]
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:13:33.285839+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:13:50.308025+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:13:54.394821+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:03.776806+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:06.657096+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:10.704989+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:15.003735+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:17.253273+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:18.64996+10 ovur6bbsklbmsa8ee1ilkpdor3 nath...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:20.186421+10 ovur6bbsklbmsa8ee1ilkpdor3 nat...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:22.202408+10 li0iig5tuajls26cqj37psa132 kar...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:23.477619+10 li0iig5tuajls26cqj37psa132 kar...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-22 11:14:30.680531+10 li0iig5tuajls26cqj37psa132 kar...
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "s_cc"
LINE 1: s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
ERROR: syntax error at or near "["
LINE 1: [[B]] s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-28 16:47:39.118013+10 r8sslpmo4tuhsdetl3agc4ji83 nat...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-28 16:47:40.337277+10 r8sslpmo4tuhsdetl3agc4ji83 nat...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-28 16:47:41.384364+10 r8sslpmo4tuhsdetl3agc4ji83 nat...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-28 16:48:06.469591+10 6j319di6vt4erjkva4l000kik7 roc...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-28 16:48:26.936489+10 r8sslpmo4tuhsdetl3agc4ji83 nat...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-08-28 16:51:34.442362+10 6j319di6vt4erjkva4l000kik7 roc...
^
ERROR: syntax error at or near "ID"
LINE 1: ID=52a2e4941b1b10e7a8575a39fc50f184 s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage%7E%5B1%5D;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "["
LINE 1: [[B]]
^
Query buffer reset (cleared).
invalid command \n
ERROR: syntax error at or near "2007"
LINE 1: 2007-09-06 16:00:52.318355+10 s9a7slqt1bjf54vm3cc3798mv7 roc...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] true 8/2007 s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-09-11 16:44:38.081365+10 t88omkoa2v774b3uvbmpa5fuj6 nat...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] true 8/2007 s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-09-11 16:44:39.588316+10 t88omkoa2v774b3uvbmpa5fuj6 nat...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] true 8/2007 s_cc=true;
^
ERROR: syntax error at or near "s_refresh"
LINE 1: s_refresh=Homepage;
^
ERROR: syntax error at or near "s_sq"
LINE 1: s_sq=paypalglobal%3D%2526pid%253DHomepage%2526pidt%253D1%252...
^
ERROR: syntax error at or near "2007"
LINE 1: 2007-09-11 16:44:47.444287+10 t88omkoa2v774b3uvbmpa5fuj6 nat...
^
ERROR: syntax error at or near "["
LINE 1: [[B]] true 8/2007 s_cc=true;
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Restoring pg_dump Backup with psql Fails
@ 2007-12-29 04:54 Joshua D. Drake <jd@commandprompt.com>
parent: Phillip Smith <phillip.smith@weatherbeeta.com.au>
1 sibling, 1 reply; 8+ messages in thread
From: Joshua D. Drake @ 2007-12-29 04:54 UTC (permalink / raw)
To: Phillip Smith <phillip.smith@weatherbeeta.com.au>; +Cc: 'Tom Lane' <tgl@sss.pgh.pa.us>; pgsql-admin
Phillip Smith wrote:
> Sorry Tom - I should know better :)
>
> I've attached the first 512 lines of the output from psql. The whole output
> is 3mb.
>
You have several problems in this dump. One it appears that some of the
releations already exist. Did you by chance accidently create stuff
within template1 at some point?
Secondly you need to look into iconv to fix your invalid UTF8 data.
Joshua D. Drake
> Cheers,
> ~p
>
>> -----Original Message-----
>> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
>> Sent: Saturday, 29 December 2007 13:26
>> To: Phillip Smith
>> Cc: pgsql-admin@postgresql.org
>> Subject: Re: [ADMIN] Restoring pg_dump Backup with psql Fails
>>
>> "Phillip Smith" <phillip.smith@weatherbeeta.com.au> writes:
>>> 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...
>>> ^
>> Please show us the *first* few errors, not some randomly chosen ones.
>> The above looks like a COPY has failed and psql has started thinking
>> that copy-data lines are commands, but how or why that happened is
>> not in evidence.
>>
>> regards, tom lane
>
>
> 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.
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Restoring pg_dump Backup with psql Fails
@ 2007-12-29 05:09 Tom Lane <tgl@sss.pgh.pa.us>
parent: Phillip Smith <phillip.smith@weatherbeeta.com.au>
1 sibling, 0 replies; 8+ messages in thread
From: Tom Lane @ 2007-12-29 05:09 UTC (permalink / raw)
To: Phillip Smith <phillip.smith@weatherbeeta.com.au>; +Cc: pgsql-admin
"Phillip Smith" <phillip.smith@weatherbeeta.com.au> writes:
> I've attached the first 512 lines of the output from psql. The whole output
> is 3mb.
Hmm, these are a bit troubling:
> ERROR: relation "grps" already exists
> ...
> ERROR: relation "stock" already exists
because you claimed you were restoring into an empty database ---
either you're mistaken or there is an interesting bug in pg_dump.
Please look into that more closely.
It's hard to be entirely certain, but the subsequent errors seem to
mostly flow from having pre-existing tables "grps" and "stock" that
don't match what the dump script is expecting.
There seems to be a separate encoding problem too:
> ERROR: invalid byte sequence for encoding "UTF8": 0x96
> HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
> CONTEXT: COPY dwh_cust, line 7413
> ERROR: invalid byte sequence for encoding "UTF8": 0xe86d65
> HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
> CONTEXT: COPY dwh_stk, line 323461
You didn't mention what PG version you are dumping from, but I'm
thinking it was one that wasn't very strict about encoding correctness.
You may need to clean up the dump file with iconv or some similar tool
--- look through the PG archives for lots of previous discussions about
that.
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Restoring pg_dump Backup with psql Fails
@ 2007-12-31 01:40 Phillip Smith <phillip.smith@weatherbeeta.com.au>
parent: Joshua D. Drake <jd@commandprompt.com>
0 siblings, 1 reply; 8+ messages in thread
From: Phillip Smith @ 2007-12-31 01:40 UTC (permalink / raw)
To: 'Joshua D. Drake' <jd@commandprompt.com>; +Cc: 'Tom Lane' <tgl@sss.pgh.pa.us>; pgsql-admin
> You have several problems in this dump. One it appears that some of the
> releations already exist. Did you by chance accidently create stuff
> within template1 at some point?
I think I've found my problem:
[postgres@stirling backups]$ psql template1
Welcome to psql 8.2.4, the PostgreSQL interactive terminal.
template1=# \d
List of relations
Schema | Name | Type | Owner
--------+--------------+-------+----------
public | buyers | table | postgres
public | creditors | table | postgres
public | debtors | table | postgres
public | grps | table | postgres
public | po | table | postgres
public | sales_orders | table | postgres
public | stkmvt | table | postgres
public | stock | table | postgres
public | sys | table | postgres
(9 rows)
template1=#
I don't know how or when those tables were created in template1 - they're
certainly not supposed to be there or needed. Is it safe to just DROP the
tables from template1?
> Secondly you need to look into iconv to fix your invalid UTF8 data.
My bad - the old database was using SQL_ASCII encoding, but when I recreated
it I let it default to UTF8.
Re-created it again with SQL_ASCII encoding, which didn't copy the tables
from template1 and now the restore seems to be going OK :)
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.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Restoring pg_dump Backup with psql Fails
@ 2007-12-31 01:59 Tom Lane <tgl@sss.pgh.pa.us>
parent: Phillip Smith <phillip.smith@weatherbeeta.com.au>
0 siblings, 1 reply; 8+ messages in thread
From: Tom Lane @ 2007-12-31 01:59 UTC (permalink / raw)
To: Phillip Smith <phillip.smith@weatherbeeta.com.au>; +Cc: 'Joshua D. Drake' <jd@commandprompt.com>; pgsql-admin
"Phillip Smith" <phillip.smith@weatherbeeta.com.au> writes:
> I think I've found my problem:
> I don't know how or when those tables were created in template1 - they're
> certainly not supposed to be there or needed. Is it safe to just DROP the
> tables from template1?
Yeah, but what other user-created stuff (functions for instance) might
be in there?
You might want to drop template1 and recreate it from template0.
(There's a blow-by-blow article about doing that on techdocs, IIRC.)
regards, tom lane
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Restoring pg_dump Backup with psql Fails
@ 2007-12-31 02:18 Phillip Smith <phillip.smith@weatherbeeta.com.au>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 8+ messages in thread
From: Phillip Smith @ 2007-12-31 02:18 UTC (permalink / raw)
To: pgsql-admin
> Yeah, but what other user-created stuff (functions for instance) might
> be in there?
> You might want to drop template1 and recreate it from template0.
> (There's a blow-by-blow article about doing that on techdocs, IIRC.)
I think I'll do that :)
Thanks Tom & Joshua - you've been most helpful as always,
~p
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.
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2007-12-31 02:18 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-12-29 00:27 Restoring pg_dump Backup with psql Fails Phillip Smith <phillip.smith@weatherbeeta.com.au>
2007-12-29 02:26 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-12-29 03:48 ` Phillip Smith <phillip.smith@weatherbeeta.com.au>
2007-12-29 04:54 ` Joshua D. Drake <jd@commandprompt.com>
2007-12-31 01:40 ` Phillip Smith <phillip.smith@weatherbeeta.com.au>
2007-12-31 01:59 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-12-31 02:18 ` Phillip Smith <phillip.smith@weatherbeeta.com.au>
2007-12-29 05:09 ` Tom Lane <tgl@sss.pgh.pa.us>
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