From: Tom Lane <tgl@sss.pgh.pa.us>
To: Guillaume Lelarge <guillaume@lelarge.info>
Cc: Daniel Gustafsson <daniel@yesql.se>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Extensions not dumped when --schema is used
Date: Wed, 20 May 2020 10:39:18 -0400
Message-ID: <24787.1589985558@sss.pgh.pa.us> (raw)
In-Reply-To: <CAECtzeVD7ktWWE=23pb5o4kNbEEjQZJ5w+skEmM0yoW7NtfSqg@mail.gmail.com>
References: <CAECtzeXOt4cnMU5+XMZzxBPJ_wu76pNy6HZKPRBL-j7yj1E4+g@mail.gmail.com>
<000780DC-6E7E-46D7-AE5A-E56405AC9204@yesql.se>
<CAECtzeVD7ktWWE=23pb5o4kNbEEjQZJ5w+skEmM0yoW7NtfSqg@mail.gmail.com>
Guillaume Lelarge <guillaume@lelarge.info> writes:
> Le mer. 20 mai 2020 à 11:26, Daniel Gustafsson <daniel@yesql.se> a écrit :
>> The question is what --extensions should do: only dump any
>> extensions that objects in the schema depend on; require a pattern and only
>> dump matching extensions; dump all extensions (probably not) or something
>> else?
> Actually, "dump all extensions" (#3) would make sense to me, and has my
> vote.
I think that makes no sense at all. By definition, a dump that's been
restricted with --schema, --table, or any similar switch is incomplete
and may not restore on its own. Typical examples include foreign key
references to tables in other schemas, views using functions in other
schemas, etc etc. I see no reason for extension dependencies to be
treated differently from those cases.
In any use of selective dump, it's the user's job to select a set of
objects that she wants dumped (or restored). Trying to second-guess that
is mostly going to make the feature less usable for power-user cases.
As a counterexample, what if you want the dump to be restorable on a
system that doesn't have all of the extensions available on the source?
You carefully pick out the tables that you need, which don't require the
unavailable extensions ... and then pg_dump decides you don't know what
you're doing and includes all the problematic extensions anyway.
I could get behind an "--extensions=PATTERN" switch to allow selective
addition of extensions to a selective dump, but I don't want to see us
overruling the user's choices about what to dump.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, guillaume@lelarge.info, daniel@yesql.se
Subject: Re: Extensions not dumped when --schema is used
In-Reply-To: <24787.1589985558@sss.pgh.pa.us>
References: <CAECtzeXOt4cnMU5+XMZzxBPJ_wu76pNy6HZKPRBL-j7yj1E4+g@mail.gmail.com> <000780DC-6E7E-46D7-AE5A-E56405AC9204@yesql.se> <CAECtzeVD7ktWWE=23pb5o4kNbEEjQZJ5w+skEmM0yoW7NtfSqg@mail.gmail.com> <24787.1589985558@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox