Re: TR: Issue: --exclude-schema flag not working with pgrestore - Mailing list pgsql-bugs

From ROCHER Julien
Subject Re: TR: Issue: --exclude-schema flag not working with pgrestore
Date
Msg-id PR0P264MB04927B42E2CDD12982180587EDD59@PR0P264MB0492.FRAP264.PROD.OUTLOOK.COM
Whole thread Raw
In response to TR: Issue: --exclude-schema flag not working with pgrestore  (ROCHER Julien <julien.rocher@emeria.eu>)
List pgsql-bugs

Hi again,

 

I was wondering though, do you know why it is different from pgdump  -N behavior (Do not dump any schemas matching pattern) ?

 

 

Julien ROCHER

Développeur Team Data - Migration

 

Emeria Technologies

76-78 Avenue des Champs Elysées – 75008 Paris 

06 17 17 60 64

julien.rocher@emeria.eu

 

 

De : ROCHER Julien <julien.rocher@emeria.eu>
Date : mercredi, 11 janvier 2023 à 15:16
À : Julien Rouhaud <rjuju123@gmail.com>
Objet : Re: TR: Issue: --exclude-schema flag not working with pgrestore

Ok thank you for you feedback

 

Julien ROCHER

Développeur Team Data - Migration

 

Emeria Technologies

76-78 Avenue des Champs Elysées – 75008 Paris 

06 17 17 60 64

julien.rocher@emeria.eu

 

 

 

 

 

 

 

 

De : Julien Rouhaud <rjuju123@gmail.com>
Date : mercredi, 11 janvier 2023 à 14:27
À : ROCHER Julien <julien.rocher@emeria.eu>
Objet : Re: TR: Issue: --exclude-schema flag not working with pgrestore

On Wed, Jan 11, 2023 at 10:43:10AM +0000, ROCHER Julien wrote:
>
> Indeed this partially solved the problem. However, although it doesn’t try to
> restore the “country.number" table, it still tries to create the “country”
> schema. Do you think it’s wanted ?

Yes that's the wanted behavior.  Per documentation:

 -N schema / --exclude-schema=schema
    Do not restore objects that are in the named schema

So it filters objects **in** the schema but not the schema itself.

If you want to also ignore the CREATE SCHEMA order, or some fancier behavior,
you need to use the --list / --use-list and cherry pick the parts you want to
keep or discard.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Behavior of pg_catalog dependent on search_path: expected or bug?
Next
From: PG Bug reporting form
Date:
Subject: BUG #17771: add a "status" column to the pg_rules system view