From: Martín Marqués <martin@2ndquadrant.com>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Subject: Re: pg_dump doesn't dump new objects created in schemas from extensions
Date: Fri, 17 Jun 2016 14:21:01 -0300
Message-ID: <24a4d9cf-025d-d855-fe76-3af3f878174d@2ndquadrant.com> (raw)
In-Reply-To: <CAB7nPqQJzP1dLCwa9uj-keJafmLd3KXDQbRmsSYZbkNz3nu_uA@mail.gmail.com>
References: <409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com>
<20160616185547.GA72247@alvherre.pgsql>
<CAPdiE1wgOVvWq3q9W3wAKrin1LnQevwQQet+qGoe_sMnfRbbjA@mail.gmail.com>
<CAB7nPqQJzP1dLCwa9uj-keJafmLd3KXDQbRmsSYZbkNz3nu_uA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
El 17/06/16 a las 03:35, Michael Paquier escribió:
> On Fri, Jun 17, 2016 at 4:21 AM, Martín Marqués <martin@2ndquadrant.com> wrote:
>> IMO, this assignment:
>>
>> tbinfo->dobj.dump = tbinfo->dobj.namespace->dobj.dump_contains;
>>
>> should be replaced by a call to some new function which would be more
>> or less a copy of selectDumpableNamespace, but without the
>> checkExtensionMembership call.
>
> Ah, I see. Yes this is definitely wrong. The namespace itself may be
> part of an extension but we do not check for it at all. See for
> example the patch attached that is giving what I would expect is the
> correct behavior.
This is a new version of your patch that checks for schema inclusion or
exclusion.
If there are no complains, I could apply similar changes on other
objects for a more complete patch.
Thoughts, objections?
--
Martín Marqués http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugsAttachments:dump-table-on-extension-schema.patch (invalid/octet-stream, 1.9K) downloaddiff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.cindex 13bfd2c..954f428 100644--- a/src/bin/pg_dump/pg_dump.c+++ b/src/bin/pg_dump/pg_dump.c@@ -1391,14 +1391,41 @@ selectDumpableTable(TableInfo *tbinfo, Archive *fout)
/*
* If specific tables are being dumped, dump just those tables; else, dump
- * according to the parent namespace's dump flag.+ * according to the parent namespace's dump flag. Note that the parent+ * namespace may be itself part of an extension, but not the table, in+ * which case its content needs to be explicitely dumped.
*/
if (table_include_oids.head != NULL)
tbinfo->dobj.dump = simple_oid_list_member(&table_include_oids,
tbinfo->dobj.catId.oid) ?
DUMP_COMPONENT_ALL : DUMP_COMPONENT_NONE;
else
- tbinfo->dobj.dump = tbinfo->dobj.namespace->dobj.dump_contains;+ {+ if (checkExtensionMembership(&tbinfo->dobj.namespace->dobj, fout))+ {+ /*+ * Table will be dumpable if no namespace include clause was passed,+ * or if the tables namespace is in the list of of included schema.+ * In any other case, the table will not be dumpable.+ */+ if (schema_include_oids.head == NULL ||+ simple_oid_list_member(&schema_include_oids,+ tbinfo->dobj.namespace->dobj.catId.oid))+ tbinfo->dobj.dump = DUMP_COMPONENT_ALL;+ else+ tbinfo->dobj.dump = DUMP_COMPONENT_NONE;+ /*+ * If we excluded the namespace we should exclude the table as well.+ * It seems incorrect, as the namespace will in any case get created+ * during the restore by the extension.+ */+ if (simple_oid_list_member(&schema_exclude_oids,+ tbinfo->dobj.namespace->dobj.catId.oid))+ tbinfo->dobj.dump = DUMP_COMPONENT_NONE;+ }+ else+ tbinfo->dobj.dump = tbinfo->dobj.namespace->dobj.dump_contains;+ }
/*
* In any case, a table can be excluded by an exclusion switch
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-bugs@postgresql.org
Cc: martin@2ndquadrant.com, michael.paquier@gmail.com, alvherre@2ndquadrant.com
Subject: Re: pg_dump doesn't dump new objects created in schemas from extensions
In-Reply-To: <24a4d9cf-025d-d855-fe76-3af3f878174d@2ndquadrant.com>
References: <409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com> <20160616185547.GA72247@alvherre.pgsql> <CAPdiE1wgOVvWq3q9W3wAKrin1LnQevwQQet+qGoe_sMnfRbbjA@mail.gmail.com> <CAB7nPqQJzP1dLCwa9uj-keJafmLd3KXDQbRmsSYZbkNz3nu_uA@mail.gmail.com> <24a4d9cf-025d-d855-fe76-3af3f878174d@2ndquadrant.com>
* 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