Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFjXQ-0003Iq-89 for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jun 2016 14:53:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bFjXP-0005Xr-NM for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jun 2016 14:53:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bFjXP-0005Xd-9G for pgsql-bugs@postgresql.org; Wed, 22 Jun 2016 14:53:55 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFjXM-0001q7-A9 for pgsql-bugs@postgresql.org; Wed, 22 Jun 2016 14:53:53 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 8EF945F796; Wed, 22 Jun 2016 10:53:49 -0400 (EDT) Date: Wed, 22 Jun 2016 10:53:49 -0400 From: Stephen Frost To: Tom Lane Cc: =?iso-8859-1?Q?Mart=EDn_Marqu=E9s?= , Michael Paquier , Alvaro Herrera , PostgreSQL mailing lists Subject: Re: pg_dump doesn't dump new objects created in schemas from extensions Message-ID: <20160622145349.GK21416@tamriel.snowman.net> References: <409fe594-f4cc-89f5-c0d2-0a921987a864@2ndquadrant.com> <20160616185547.GA72247@alvherre.pgsql> <24a4d9cf-025d-d855-fe76-3af3f878174d@2ndquadrant.com> <29478.1466605967@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="XkHy4BYyPR06YPPe" Content-Disposition: inline In-Reply-To: <29478.1466605967@sss.pgh.pa.us> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-77-generic (x86_64) X-Uptime: 10:40:24 up 120 days, 11:33, 41 users, load average: 0.04, 0.12, 0.13 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --XkHy4BYyPR06YPPe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Tom Lane (tgl@sss.pgh.pa.us) wrote: > =3D?UTF-8?Q?Mart=3Dc3=3Dadn_Marqu=3Dc3=3Da9s?=3D = writes: > > This is a new version of your patch that checks for schema inclusion or > > exclusion. >=20 > > If there are no complains, I could apply similar changes on other > > objects for a more complete patch. >=20 > > Thoughts, objections? >=20 > 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 --XkHy4BYyPR06YPPe Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJXaqZ9AAoJEO1sijiDR2RV1QAP+QFBo6XuxhpD1+IRn8BDUapP cvGB+eiuPW8+ZMNgyWy8NY5kj+xMDheiBYZ/kqSXRtS6hSjcL1GgJWo3SdX1QFpc yqfnaVIPBI/YrUkCGDSmPjDOlrju0j0YL1+WCRYhm3hcShkZrGnI4SaiIM/Gj+dN raQIREt3/ZBcXCWtRCmO6e4CSSUM40R8sBc5EJMJ5VHDObR1NWDyzJL4xHu4cRmN StgTwbtUuWoGE241ixHQbgIcXbGFmmoZRw15eZjqAkuQ7bg3oJGwKCcUNUWeJxV+ cPcEAXjfHY8dQjH/U7k2qwDchKhuHpzOVFf03c83oiqnypHgsTwMydCLdaVQg1ye 5qIv+Oh6xU8pDp4HTEcM+0XkAKIfVH/K9cbZRjuXmV+cwZJtjZBHhDEa80w8u0BV LyWRsCxS0KL4HZQBqp5o9RAqXqNzAfnNHmlrWTHqOhI1gK1Kbz3x1tClce58moFf C9PtNWYr3J3mnW0nEdkNfc0XB7o9w1safewFMOLYZNrDT/QpHwSCH4bP5DkP3Lbr TiyRG7MWvHI2ltOvMXFxkcB2BPZEGhbF/tKQkuxnuwuO8N2z5aqWhSoR5YqRo3Lx jA2jVuVspCBdZGGF/1pyRyHqnz7YfQMPnjhWjA7nrHS3z9eIypAF0Mo8OzPZaoa0 mRFBFba1ulRPOzp9vdgQ =uA5b -----END PGP SIGNATURE----- --XkHy4BYyPR06YPPe--