Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZf3U-0008Ba-3W for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2018 15:46:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZf3T-0001Ql-OL for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2018 15:46:11 +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 1eZf07-00057q-3F for pgsql-hackers@lists.postgresql.org; Thu, 11 Jan 2018 15:42:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eZf04-00064k-Gq for pgsql-hackers@postgresql.org; Thu, 11 Jan 2018 15:42:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w0BFgc3o013648; Thu, 11 Jan 2018 10:42:38 -0500 From: Tom Lane To: Michael Paquier cc: Postgres hackers Subject: Re: pg_get_functiondef forgets about most GUC_LIST_INPUT GUCs In-reply-to: <20180111064900.GA51030@paquier.xyz> References: <20180111064900.GA51030@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Thu, 11 Jan 2018 15:49:00 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13646.1515685358.1@sss.pgh.pa.us> Date: Thu, 11 Jan 2018 10:42:38 -0500 Message-ID: <13647.1515685358@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > While reviewing another patch related to the use of pg_strcasecmp in the > backend, I have noticed this bit in ruleutils.c: > /* > * Some GUC variable names are 'LIST' type and hence must not > * be quoted. > */ > if (pg_strcasecmp(configitem, "DateStyle") == 0 > || pg_strcasecmp(configitem, "search_path") == 0) > appendStringInfoString(&buf, pos); > else > simple_quote_literal(&buf, pos); > However this fails to consider all GUCs marked as GUC_LIST_INPUT, like > the recent wal_consistency_checking. Mmm, yeah, probably time to find a more maintainable solution to that. > guc.c already holds a find_option() > which can be used to retrieve the flags of a parameter. What about using > that and filtering by GUC_LIST_INPUT? This requires exposing the > function, and I am not sure what people think about that. Don't like exposing find_option directly, but I think it would make sense to provide an API along the lines of int GetConfigOptionFlags(const char *name, bool missing_ok). regards, tom lane