Re: TR: Issue: --exclude-schema flag not working with pgrestore

From: ROCHER Julien <julien(dot)rocher(at)emeria(dot)eu>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: TR: Issue: --exclude-schema flag not working with pgrestore
Date: 2023-02-05 15:52:49
Message-ID: PR0P264MB04927B42E2CDD12982180587EDD59@PR0P264MB0492.FRAP264.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)rocher(at)emeria(dot)eu<mailto:julien(dot)rocher(at)emeria(dot)eu>

De : ROCHER Julien <julien(dot)rocher(at)emeria(dot)eu>
Date : mercredi, 11 janvier 2023 à 15:16
À : Julien Rouhaud <rjuju123(at)gmail(dot)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(dot)rocher(at)emeria(dot)eu<mailto:julien(dot)rocher(at)emeria(dot)eu>

De : Julien Rouhaud <rjuju123(at)gmail(dot)com>
Date : mercredi, 11 janvier 2023 à 14:27
À : ROCHER Julien <julien(dot)rocher(at)emeria(dot)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.

In response to

Browse pgsql-bugs by date

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