Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ay1iH-0007MP-9a for pgsql-hackers@arkaria.postgresql.org; Wed, 04 May 2016 18:39:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ay1iG-0001Cu-Nf for pgsql-hackers@arkaria.postgresql.org; Wed, 04 May 2016 18:39:56 +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 1ay1iE-00018M-Ty for pgsql-hackers@postgresql.org; Wed, 04 May 2016 18:39:55 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ay1iC-0005zq-OT for pgsql-hackers@postgresql.org; Wed, 04 May 2016 18:39:53 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 523345F7A6; Wed, 4 May 2016 14:39:52 -0400 (EDT) Date: Wed, 4 May 2016 14:39:52 -0400 From: Stephen Frost To: pgsql-hackers@postgresql.org Subject: pg_dump vs. TRANSFORMs Message-ID: <20160504183952.GE10850@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6wksViTHwOHy2myV" Content-Disposition: inline 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: 14:25:20 up 71 days, 15:18, 21 users, load average: 0.03, 0.08, 0.13 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -4.0 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --6wksViTHwOHy2myV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings all, While testing pg_dump, I discovered that there seems to be an issue when it comes to TRANSFORMs. I'll be the first to admit that I'm not terribly familiar with transforms, but I do know that if you create one using functions from pg_catalog (as our regression tests do), the CREATE TRANSFORM statement isn't dumped out and therefore we don't test the dump/restore of transforms, even with our current pg_upgrade test process. In the regression tests, we do: CREATE TRANSFORM FOR int LANGUAGE SQL ( FROM SQL WITH FUNCTION varchar_transform(internal), TO SQL WITH FUNCTION int4recv(internal)); but if you do that and then run pg_dump, you don't see any mention of any transforms in the dump file. This is because there's a couple of checks towards the top of dumpTransform(): /* Cannot dump if we don't have the transform functions' info */ if (OidIsValid(transform->trffromsql)) { =20 fromsqlFuncInfo =3D findFuncByOid(transform->trffromsql); if (fromsqlFuncInfo =3D=3D NULL) return; } if (OidIsValid(transform->trftosql)) { =20 tosqlFuncInfo =3D findFuncByOid(transform->trftosql); if (tosqlFuncInfo =3D=3D NULL) return; } These checks are looking for the functions used by the transform in the list of functions that pg_dump has loaded, but in 9.5, we don't load any of the function in pg_catalog, and even with my patches, we only dump the functions in pg_catalog that have an ACL which has been changed from the default. Given that there are lots of functions in pg_catalog, we probably don't want to just load them all, all the time, but what we should probably do is grab any functions which are depended on by any transforms. Or we could change dumpTransform() to actually issue a query to get the function information which it needs when we've decided to dump a given transform. For my 2c, this is a bug that needs to be fixed and back-patched to 9.5. I'm going to continue working on my pg_dump test suite for now, but I can look at fixing this after PGCon if no one else fixes it first. Thanks! Stephen --6wksViTHwOHy2myV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJXKkH3AAoJEO1sijiDR2RVODIP/RnmVMLEZ8eOyY0XH/dw3cJr zt8NiKsjc20t7TlR1I/5Ky52Wmlm5ijHKxLci29EoMcGffKokvxDUSX5v+5gjtsN PTkaLrlEdsgdycOSAHlh6Om7y8qNcA0yUYUxSOwg2erMNz+I3Nqv/iX3fNFLMZ8c qqA5UmkElA0wxAELq7DbzmxSExYyz1MYLK04dW91NFPzBXv4aK6WYkePao7REzk/ PbvvZsybZPl09HZpxowGrIhpzyOoviA9AQiUM1Oa9THkUew/3dMsNcJZ11XjfkqQ YVK2WCIy8rVCDJ5oRgGoxvDgbrLyxRfc885CvhjzxwCgLvGb+Y5cZuORP3xZVUN+ P/gG5D/2MLpFqNZYoAlQrSwmf215LD5veDGKpyRSYAPf16dr7CCjKsxn1ib4+FYG 4UMJBaJdYjsCm6Q7j9v8sZp/jpWjjE3Iu4Xi4I9TDscI+MzHdUyiTAB4fYh5BT6l Ng7rAp4IMz2PmHd2ozJg9d0B+d99KDqPxgg2FnWIAD7PVPQ4Wr/ZOfENF16Ohftk B+sqZMzbCuMmwJ1CpIbO/nig/6b6Ru8bcYMeHs9KWqzAjtsV5RzTP/do0KUfj25C QNsBV4u4gKjy4f0GytvJfASUdA5BDc23JefQgdvb/Eqef6lHA3LrRqkPcdVgUYZN vibvRXSOUVgWCmJ5e8yy =uaIK -----END PGP SIGNATURE----- --6wksViTHwOHy2myV--