From: Stephen Frost <sfrost@snowman.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Martín Marqués <martin@2ndquadrant.com>
Cc: 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: Wed, 22 Jun 2016 10:53:49 -0400
Message-ID: <20160622145349.GK21416@tamriel.snowman.net> (raw)
In-Reply-To: <29478.1466605967@sss.pgh.pa.us>
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>
<29478.1466605967@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> =?UTF-8?Q?Mart=c3=adn_Marqu=c3=a9s?= <martin@2ndquadrant.com> writes:
> > 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?
>
> This patch seems to me to be entirely the wrong approach, as what it
> will result in is an enormous amount of code duplication. There's
> nothing fundamentally wrong with looking at the parent namespace to
> decide whether to dump or not. The difficulty is that we need to draw
> a distinction *at the namespace level* between "dump this namespace"
> and "dump objects within this namespace". The correct behavior for
> a namespace owned by an extension is to do the latter (for objects
> not belonging to any extension) but not the former. So instead of
> just one "dump" flag, we need two such flags for namespaces. The
> various selectDumpableFoo routines need one-line adjustments as to
> which flag they look at in the parent namespace. They do *not*
> need copy-and-paste of their entire current contents.
Agreed.
> In HEAD, this should be a pretty straightforward change since Stephen
> Frost has already created infrastructure that allows distinguishing which
> "components" of an object to dump. There doesn't seem to be a bit that
> corresponds to "objects within this schema", but that shouldn't be hard
> to add.
> The DUMP_COMPONENT infrastructure doesn't exist in older branches
> so I think you'd just have to invent an additional bool field in
> NamespaceInfo structs to say whether to dump contained objects.
In HEAD, this already exists in the form of 'dump_contains', which sits
next to 'dump' in the DumpableObject struct. I added that independent
field as it allows us to say things like "dump components X, Y, Z of
this object, and components A, B, C of objects *contained* by this
object." What that means is that we can dump, say, just the privileges
of a namespace, but dump all of the components of objects which live
inside of that namespace.
If all we need is a flag for the back branches (I've not looked very
closely yet...), then I'd suggest simply adding that 'dump_contains'
field as a boolean in the back branches and using that.
> A slightly different approach is to ignore the DumpComponents stuff
> and just add a bool field in NamespaceInfo for all branches. Perhaps
> this would even be the right thing, as I may be misunderstanding what
> Stephen intends the DumpComponents bits to be used for. Would be
> interesting to hear Stephen's take on this.
Putting 'dump_contains' into the NamespaceInfo wouldn't work as objects
which are members of extensions are also "contained" by that extension,
allowing us to say things like "dump all of the ACLs for all of the
objects which are members of this extension, but not the extension
itself."
We could possibly rework it such that all 'dump_contains' bitmasks are
part of the data structures for the 'containing' object instead of being
associated with *every* object. That might be a bit cleaner, but might
also mean that it gets forgotten as it's not sitting right next to the
main 'dump' bitmask.
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
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: sfrost@snowman.net, tgl@sss.pgh.pa.us, 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: <20160622145349.GK21416@tamriel.snowman.net>
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> <29478.1466605967@sss.pgh.pa.us> <20160622145349.GK21416@tamriel.snowman.net>
* 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