Re: pg_restore --clean failing due to dependancies

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "Arnaud L(dot)" <arnaud(dot)listes(at)codata(dot)eu>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_restore --clean failing due to dependancies
Date: 2016-11-15 16:42:13
Message-ID: 2920034b-7119-0e53-db03-9804af35bcca@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/15/2016 07:55 AM, Arnaud L. wrote:
> Le 15/11/2016 à 16:21, Adrian Klaver a écrit :
>>> The restore fails on a lot of statements, complaining about
>>> dependencies.
>>> For instance, "cannot drop rule _RETURN on view myview1 because view
>>> myview1requires it". Or "cannot drop constraint mypkey on table my table
>>> because other objects depend on it [list of foreign keys]".
>>
>> So where are the above objects, eg what schema?
>
> They are in a schema that is included in the dump (more precisely, not
> excluded from).
> It happens in all schemas, not a specific one.
>
>> pg_restore -l "D:\db.dump"
>> to see what pg_restore thinks is the order of restore.
>
> OK I did that.
> The output is pretty big.
> The second error is a consequence of the first one (they were not
> foreign keys but views, sorry for the mistake).
> So the very first error from pg_restore, the "cannot drop rule
> _return..." is TOC 11330.
> It is on the line 4948 in the pg_restore -l output (does this order
> matter, or is it the TOC ?).

The line order:

https://www.postgresql.org/docs/9.5/static/app-pgrestore.htm

"The listing file consists of a header and one line for each item, e.g.:

....

Semicolons start a comment, and the numbers at the start of lines refer
to the internal archive ID assigned to each item.

Lines in the file can be commented out, deleted, and reordered. For example:
......
"

> The view is number 1467 in the TOC, and is on line 2353 of the
> pg_restore -l output.
>
>
> --
> Arnaud
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-11-15 16:50:13 Re: pg_restore --clean failing due to dependancies
Previous Message Tom Lane 2016-11-15 16:26:23 Re: pg_restore --clean failing due to dependancies