Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eyVsE-0006V0-PP for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Mar 2018 05:01:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eyVsC-0006Zd-Dk for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Mar 2018 05:01:16 +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.89) (envelope-from ) id 1eyVsB-0006XG-NB for pgsql-hackers@lists.postgresql.org; Wed, 21 Mar 2018 05:01:16 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eyVs6-0002hL-Q7 for pgsql-hackers@postgresql.org; Wed, 21 Mar 2018 05:01:15 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id EAB5414F6; Wed, 21 Mar 2018 01:01:08 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Wed, 21 Mar 2018 01:01:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=UfrhnRj9+vjcFdE+6oGIrkUYtNUDUT7C5Rd2Eq3l2t8=; b=yt/ZlWKn p5cIK4QdZqPx47gFekQfd/oG8u5Lprurdlgoog8XBIIDqHOs6EqkeXlrHEy1AHOr vPbeeqxjRBHQ2BcW1gHSV9SZCUtSMTpfFYzEVzlhMb4Q/MbIG2ccb2Zrv5pd9dq5 jTzO8KX84rgW+kKysZE8fBhn4DzMRU1wZX+U9ZL6Uc3gJjflZJcrHsFUwF2xMZWw ca/vIcwPh5uOirkjJG7yEJMZRCPiNRJZmbYKdN228CxesNwx9rEoKpTW1mGXg/Qm Fe0vNOksO2Koy4zisNon+G27lHsnIbqn0L0MzDb5gOl0pk07VQ1aPLG2w2Y5Vw9t THq0pwGxo91kBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=UfrhnRj9+vjcFdE+6oGIrkUYtNUDU T7C5Rd2Eq3l2t8=; b=agJI7SVfkTO+jU+RPa0msbgRuOvOhSt2cGFQwo2hhSwDo 9RuldBG8AXBSvgd4ADl/6YOK9u1efy31Gyu77xmHpXFC9tj+J8qkOQUgE73DcpNZ Ge4d9mOBor8hVJBX+EVu1nOq9An4I+YFWV4ul2IQNTMVl515ZsGuhKK81cvTIEM0 5FKzPVEzv0cZVbpq8ul7dUgswJYKhjW0japHNxDeMoGNR+zrI+suGMeJ3bFOt8Cj m9nsM+K9Aly+jjRp5jpgo3uPMrYO81NXa52ui5cX98GjXHjn9qLvHYtmCB3g9jIv 3fOXtt5mOGwJreGaE7IO8B9CXFELDS2flINcf7Vkg== X-ME-Sender: Received: from paquier.xyz (mp76f1fb7f.ap.nuro.jp [118.241.251.127]) by mail.messagingengine.com (Postfix) with ESMTPA id AFB1B240DC; Wed, 21 Mar 2018 01:01:06 -0400 (EDT) Date: Wed, 21 Mar 2018 14:01:03 +0900 From: Michael Paquier To: Tom Lane Cc: Kyotaro HORIGUCHI , pavel.stehule@gmail.com, a.zakirov@postgrespro.ru, pgsql-hackers@postgresql.org Subject: Re: pg_get_functiondef forgets about most GUC_LIST_INPUT GUCs Message-ID: <20180321050103.GD2288@paquier.xyz> References: <2637.1521501336@sss.pgh.pa.us> <20180320003951.GA4963@paquier.xyz> <10037.1521515233@sss.pgh.pa.us> <20180320.123747.43512160.horiguchi.kyotaro@lab.ntt.co.jp> <32403.1521566855@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yudcn1FV7Hsu/q59" Content-Disposition: inline In-Reply-To: <32403.1521566855@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --yudcn1FV7Hsu/q59 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Mar 20, 2018 at 01:27:35PM -0400, Tom Lane wrote: > 1. Only GUC_LIST_QUOTE variables need to be special-cased. It works > fine to treat plain LIST variables (e.g. datestyle) with the regular > code path. This is good because there are so few of them. Check. > 2. We should make an effort to minimize the number of places that know > explicitly which variables are GUC_LIST_QUOTE. In the backend, the > right thing to do is ask guc.c. In pg_dump, there's no convenient > way to ask the backend (and certainly nothing that would work against > old servers), but we should at least make sure there's only one place > to fix not two. The only way I can think about for that would be to provide this information in pg_settings using a text[] array or such which lists all the GUC flags of a parameter. That's a hell lot of infrastructure though which can be easily replaced with the maintenance of a small hardcoded parameter list. > 3. We need to prevent extensions from trying to create GUC_LIST_QUOTE > variables, because those are not going to work correctly if they're > set before the extension is loaded, nor is there any hope of pg_dump > dumping them correctly. This really depends on the elements of the list involved here, so pg_dump may be able to dump them correctly, though not reliably as that would be fully application-dependent. At the end I think that I am on board with what you are proposing here. > The attached 0001 patch does the first two things, and could be > back-patched. The 0002 patch, which I'd only propose for HEAD, > is one way we could address point 3. A different way would be > to throw a WARNING rather than ERROR and then just mask off the > problematic bit. Or we could decide that either of these cures > is worse than the disease, but I don't really agree with that. Looks roughly sane to me. + if (flags & GUC_LIST_QUOTE) + elog(FATAL, "extensions cannot define GUC_LIST_QUOTE variables"); This would be better as an ereport with ERRCODE_FEATURE_NOT_SUPPORTED I think. An ERROR is better in my opinion. - if (pg_strcasecmp(configitem, "DateStyle") == 0 - || pg_strcasecmp(configitem, "search_path") == 0) + if (GetConfigOptionFlags(configitem, true) & GUC_LIST_QUOTE) For boolean-based comparisons, I would recommend using a comparison with zero. + record = find_option(name, false, WARNING); + if (record == NULL) LOG instead of WARNING? -- Michael --yudcn1FV7Hsu/q59 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlqx5w8ACgkQnvQgOdby QH0UVQ//fGo1UsIUAEb6wyXJd13ATHtb4nBE6qHEtjYAvFQe9SvsU7xmPtIiKMIE p8DNV1zUu6GP/MCFLm99LBQ5dOCDRRZvWpZAphTLTx+saBoTJLes2stt3jtnGr4N 3m5SMoM5iGb5V5B8SFS0mshLbUYxopO1BNHrXegjbLaiXCRXrfghXYK68XMwU+JM XgwPtnh6CO20huepQzthf2FuxaMGhlVuoAr51O0r5dqUMufU3gmaH9AYiMmA7ok8 8wq/TlSax7O4yhqWF/b1PNPduB7iQWKlg38Qy0ezEQBvf1EN5QSicWCkrqyWMHvi MwFYkqwT5RKZKkwF0arnXEwIL7ODTtFc3Kj450DyWQPqFrz/Q0Hoz4HvwPqjQnvp l90+vR1llVTaBdmS+Oh5cK5w8+eGgTjZD/zr9aDxYyzb8+IbdE08xoNSaL7yqEWm ruMQXNMONV2RBroyZ2bvBwl8+ePS5k/u16ndjY4CQYrufo5vXqh15xkeYB6owzDy CL5G1g4L+DawJZN9tCYF8sgdST2d4TQRX4RVpXXTKVtev1eZP+J5K1Dj/C8drh4o j2fOzU5nsPKYTMUO+diNEDxPX7I8TjllBbiPoQvaFVWI88wO+EJMGXWI1LJ3sDZ0 AfSGfjNFm54gxvAXSAzodPVjY5khIR+FHQYXI9aO27+buAjNx90= =PCLS -----END PGP SIGNATURE----- --yudcn1FV7Hsu/q59--