Re: pg_restore --clean failing due to dependancies - Mailing list pgsql-general

From Adrian Klaver
Subject Re: pg_restore --clean failing due to dependancies
Date
Msg-id 2920034b-7119-0e53-db03-9804af35bcca@aklaver.com
Whole thread Raw
In response to Re: pg_restore --clean failing due to dependancies  ("Arnaud L." <arnaud.listes@codata.eu>)
List 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.klaver@aklaver.com


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_restore --clean failing due to dependancies
Next
From: Adrian Klaver
Date:
Subject: Re: pg_restore --clean failing due to dependancies