Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUD48-0003kj-P0 for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Jan 2017 13:47:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cUD48-0002Ai-7G for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Jan 2017 13:47:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cUD47-00028r-Ar for pgsql-bugs@postgresql.org; Thu, 19 Jan 2017 13:47:47 +0000 Received: from tamriel.snowman.net ([72.66.115.51]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cUD44-0004SF-88 for pgsql-bugs@postgresql.org; Thu, 19 Jan 2017 13:47:46 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id D7D5E5F794; Thu, 19 Jan 2017 08:46:40 -0500 (EST) Date: Thu, 19 Jan 2017 08:46:40 -0500 From: Stephen Frost To: Michael Paquier Cc: Daniele Varrazzo , pgsql-bugs Subject: Re: pg_dump 9.6 doesn't honour pg_extension_config_dump for sequences Message-ID: <20170119134640.GN18360@tamriel.snowman.net> References: <20170118142443.GZ18360@tamriel.snowman.net> <20170118144537.GA18360@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9ZYmCFUXJGH+43jh" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-91-generic (x86_64) X-Uptime: 08:29:13 up 194 days, 14:53, 2 users, load average: 0.04, 0.19, 0.21 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -5.1 (-----) 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 --9ZYmCFUXJGH+43jh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Michael, * Michael Paquier (michael.paquier@gmail.com) wrote: > As far as I can see, the code path to dumpSequenceData() is taken > correctly for such a sequence. processExtensionTables() creates a > dataObj using makeTableDataInfo() only for sequences in extensions > that are dumpable. So I have been wondering what's happening for some > time, until I noticed that: > --- a/src/bin/pg_dump/pg_dump.c > +++ b/src/bin/pg_dump/pg_dump.c > @@ -15671,7 +15671,7 @@ dumpSequenceData(Archive *fout, TableDataInfo *td= info) > appendPQExpBuffer(query, ", %s, %s);\n", > last, (called ? "true" : "false")); >=20 > - if (tbinfo->dobj.dump & DUMP_COMPONENT_DATA) > + if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA) > ArchiveEntry(fout, nilCatalogId, createDumpId(), > tbinfo->dobj.name, > tbinfo->dobj.namespace->dobj.name, > Not sure if I need to laugh or cry. Attached is a patch with the fix > and new regression tests. Yeah, that looks like the right answer and matches how dumpTableData handles this, which is also why that's working correctly. I don't particularly like this arrangement though. This works because: getTables() will create the entry for the sequence and call selectDumpableTable(), which calls checkExtensionMembership(), which will set the dump flags to ACL | SECLABEL | POLICY, and then getTableData() will skip adding a data entry for it because DATA isn't set, allowing processExtensionTables() to add the DATA entry later for config tables/sequences. Now that we've got the ability to indicate which pieces of a object should be dumped, however, it seems like we could just check in checkExtensionMembership() if it's a config table and set DATA then if it is, possibly removing the need for processExtensionTables() entirely. That's really future-work, but I wanted to mention my thoughts here in case someone wants to work on it, or I might once I've cleared off the other things on my plate. For now, I'll go ahead and commit your suggested fix, and thanks for including a new regression test to cover this. Thanks again! Stephen --9ZYmCFUXJGH+43jh Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJYgMNAAAoJEO1sijiDR2RVTMkP/1AAo1C5Jpd39y4UMIARMoo+ 0wWq3KMKXYxD9LDi8hwPgnh9MqHPhkmyDZTVXCg3hrYAiOEOafAKFS8u1WdyQZ06 QEkZWFODFE9Fo5W2GjSp7xmFy3BOpqDBt9DZGmh/0Jz9W6/dSovj8MiHrEEg+c+h 9d63srBUf6CWYJwTN4v1LhaDv0UvikK3EtDB2fA71HsKL5Y0bCpp0AvsHkDAL5uh iSmDVvJZVEecGc6Z1ariLaiydChT031RPmcdNy0JGepACnppJ6w9Xxz0/yeXm6rl MmGVr7Ov01STfKmzW0qkjzdAoGiGiBj8zH83FvmsPhbqoNHgmlv5OC2wN8aJ5k9D wzwSxdutG+LErmBwJrZSlyJZMrsCVeoXHxnueV6PHfrooAJS44zPQ0xQK7cSl7hh efypKCF7Ypa9gEjmCKja4JvbrcrnJnPNVEh/HbH9MTNFWSnx3ULiFMiBOII21nMc CWkZ0PYeQLAtZoJ077fKZjIFd3pp0uacLLdk3uJfnH9E4Ns06fITG6bat14piL6t q1NmiU3N9sx9vAc9+h+irY77MYAmTIdaCUp2dt8hoZkxYAEtJBfsYCmbx4lJLQ8Y Ma8udCqNc+VUakzCzWI4T5zNw+fxXQAyzxTzX1Hl3qhFr9437MNpks24PStfRprZ SoglR7JydFbpwnlgPUQ8 =qblc -----END PGP SIGNATURE----- --9ZYmCFUXJGH+43jh--