Re: PG_DUMP/RESTORE Would like an explanation of these (non-critical) errors

From: ANdreas Wenk <a(dot)wenk(at)netzmeister-st-pauli(dot)de>
To: pgsql-general(at)postgresql(dot)org
Cc: "James B(dot) Byrne" <byrnejb(at)harte-lyne(dot)ca>
Subject: Re: PG_DUMP/RESTORE Would like an explanation of these (non-critical) errors
Date: 2009-07-03 20:05:20
Message-ID: 4A4E6480.5020201@netzmeister-st-pauli.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

James B. Byrne wrote:

Hi,
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 4; 2615 2200 SCHEMA
> public postgres
> pg_restore: [archiver (db)] could not execute query: ERROR: cannot
> drop
> schema public because other objects depend on it
> HINT: Use DROP ... CASCADE to drop the dependent objects too.
> Command was: DROP SCHEMA public;
> pg_restore: [archiver (db)] could not execute query: ERROR: schema
> "public" already exists
> Command was: CREATE SCHEMA public;
> WARNING: errors ignored on restore: 2
>
>
> The pg_dump command is:
>
> pg_dump --create --format=c --user=postgres --verbose hll_redmine |
> gzip > /var/data/pas-redmine/db/dump/hll_redmine.pgsql.gz && rsync
> -avz --bwlimit=35 --delete-after --exclude="database.yml"
> --exclude="*.log" --exclude="*cache" --exclude="*ruby_sess*"
> /var/data/pas-redmine inet03.mississauga.harte-lyne.ca:/var/data 1>
> /dev/null

--create is not working here because you select a custom format for your
dump. --create is only working with plain SQL dumps.

> The pg_restore command, which generates the error, is:
>
> gunzip < /var/data/pas-redmine/db/dump/hll_redmine.pgsql.gz |
> pg_restore --clean --user=postgres --dbname=hll_redmine ; vacuumdb
> --user=postgres --full --analyze hll_redmine 1> /dev/null

with the --clean parameter you delete existing objects in hll_redmine
but there are dependant objects. A common way to avoid this is to drop
the whole database first, create a new one and then restore the dump
into it. Means use --create instead of --clean.

Dropping the database can cause problems because you have to cut all
client connections before being able to cut it. So maybe this approach
is not working for you.

Another idea is not to use any of these parameters and dump only the data.

pg_restore -a

Cheers Andy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Black 2009-07-03 22:23:55 Re: Store derived data or use view?
Previous Message Martin Gainty 2009-07-03 19:46:50 Re: Store derived data or use view?