From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Gustafsson <daniel(at)yesql(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Extensions not dumped when --schema is used |
Date: | 2021-04-13 05:43:11 |
Message-ID: | YHUvb4QxkMfy7pjN@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Apr 04, 2021 at 03:08:02PM -0700, Noah Misch wrote:
> I noticed the patch's behavior for relations that are members of non-dumped
> extensions and are also registered using pg_extension_config_dump(). It
> depends on the schema:
>
> - If extschema='public', "pg_dump -e plpgsql" makes no mention of the
> relations.
This one is expected to me. The caller of pg_dump is not specifying
the extension that should be dumped, hence it looks logic to me to not
dump the tables marked as pg_extension_config_dump() part as an
extension not listed.
> - If extschema='public', "pg_dump -e plpgsql --schema=public" includes
> commands to dump the relation data. This surprised me. (The
> --schema=public argument causes selectDumpableNamespace() to set
> nsinfo->dobj.dump=DUMP_COMPONENT_ALL instead of DUMP_COMPONENT_ACL.)
This one would be expected to me. Per the discussion of upthread, we
want --schema and --extension to be two separate and exclusive
switches. So, once the caller specifies --schema we should dump the
contents of the schema, even if its extension is not listed with
--extension. Anyway, the behavior to select if a schema can be dumped
or not is not really related to this new code, right? And "public" is
a mixed beast, being treated as a system object and a user object by
selectDumpableNamespace().
> - If extschema is not any sort of built-in schema, "pg_dump -e plpgsql"
> includes commands to dump the relation data. This surprised me.
Hmm. But you are right that this one is inconsistent with the first
case where the extension is not listed. I would have said that as the
extension is not directly specified and that the schema is not passed
down either then we should not dump it at all, but this combination
actually does so. Maybe we should add an extra logic into
selectDumpableNamespace(), close to the end of it, to decide if,
depending on the contents of the extensions to include, we should dump
its associated schema or not? Another solution would be to make use
of schema_include_oids to filter out the schemas we don't want, but
that would mean that --extension gets priority over --schema or
--table but we did ot want that per the original discussion.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Tatsuo Ishii | 2021-04-13 05:51:48 | Retry in pgbench |
Previous Message | Noah Misch | 2021-04-13 05:36:10 | Re: pgsql: Move tablespace path re-creation from the makefiles to pg_regres |