Re: pg_restore issue

From: Jerry Sievers <gsievers19(at)comcast(dot)net>
To: Leonardo M(dot) Ramé <l(dot)rame(at)griensu(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_restore issue
Date: 2014-02-12 19:02:51
Message-ID: 8661ok6tno.fsf@jerry.enova.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Leonardo M. Ramé <l(dot)rame(at)griensu(dot)com> writes:

> On 2014-02-12 13:30:52 -0500, Tom Lane wrote:
>
>> Leonardo =?iso-8859-1?Q?M=2E_Ram=E9?= <l(dot)rame(at)griensu(dot)com> writes:
>> > Hi, I'm trying to restore a database dump using pg_restore with the
>> > following parameters:
>>
>> > pg_restore -h 127.0.0.1 -U _postgresql \
>> > -c -d postgres --exit-on-error \
>> > my_dump.backup
>>
>> > Note I used "\" to wrap the command, but the real one does not have
>> > those.
>>
>> > pg_restore: [archiver (db)] Error while PROCESSING TOC:
>> > pg_restore: [archiver (db)] Error from TOC entry 3156; 2606 432226 FK
>> > CONSTRAINT fkidturno postgres
>> > pg_restore: [archiver (db)] could not execute query: ERROR: relation
>> > "public.turnodocumento" does not exist
>> > Command was: ALTER TABLE ONLY public.turnodocumento DROP CONSTRAINT
>> > fkidturno;
>>
>> > Why is this happening?, should I change the command I'm using to create
>> > the backup?.
>>
>> The -c switch causes pg_restore to try to DROP every object it's about to
>> restore. If you're restoring into an empty database then this is useless,
>> and in fact will not work if you're also using --exit-on-error. Remove
>> one or the other switch.
>>
>> Now, if you expected that all the objects do exist in the target database,
>> then it might be worth inquiring a bit more closely into what's happening.
>>
>> regards, tom lane
>
> Tom, I've dropped the db, then createdb again, then removed the -c
> option, now I get this error:
>
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 735; 2612 213488
> PROCEDURAL LANGUAGE plpgsql postgres
> pg_restore: [archiver (db)] could not execute query: ERROR: language
> "plpgsql" already exists
> Command was: CREATE PROCEDURAL LANGUAGE plpgsql;

You can ignore that.

Just make sure you're doing the loading auto-commit and without
ON_ERROR_STOP set.

Of course, you could drop lang plpgsql from your new DB and try again
which, if that was going to be your only error, you may then run clean.

HTH

>
>
> --
> Leonardo M. Ramé
> Medical IT - Griensu S.A.
> Av. Colón 636 - Piso 8 Of. A
> X5000EPT -- Córdoba
> Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
> Cel.: +54 9 (011) 40871877

--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres(dot)consulting(at)comcast(dot)net
p: 312.241.7800

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-02-12 19:04:41 Re: pg_restore issue
Previous Message Leonardo M. Ramé 2014-02-12 18:41:38 Re: pg_restore issue