Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mLSMF-0005Af-G3 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Sep 2021 15:40:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mLSME-0000EO-FP for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Sep 2021 15:40:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mLSME-0000BG-7R for pgsql-hackers@lists.postgresql.org; Wed, 01 Sep 2021 15:40:58 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mLSMB-0002mP-7t for pgsql-hackers@lists.postgresql.org; Wed, 01 Sep 2021 15:40:57 +0000 Received: from hrk.local (p2388012-ipbf1027funabasi.chiba.ocn.ne.jp [118.6.6.12]) by oss.nttdata.com (Postfix) with ESMTPSA id 27C6461371; Thu, 2 Sep 2021 00:40:49 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.3 at oss.nttdata.com Subject: Re: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name) To: "kuroda.hayato@fujitsu.com" Cc: "'pgsql-hackers@lists.postgresql.org'" , 'Tom Lane' References: <8f985ba0-2e79-ab67-4fa4-d35024188047@oss.nttdata.com> From: Fujii Masao Message-ID: <0d5df322-c9ad-308e-982b-a3d3275bcdc0@oss.nttdata.com> Date: Thu, 2 Sep 2021 00:40:48 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-2022-jp; format=flowed; delsp=yes Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021/09/01 19:04, kuroda.hayato@fujitsu.com wrote: > OK, I split and attached like that. 0001 adds new GUC, and > 0002 allows to accept escapes. Thanks for splitting and updating the patches! Here are the comments for 0001 patch. - /* Use "postgres_fdw" as fallback_application_name. */ + /* Use GUC paramter if set */ + if (pgfdw_application_name && *pgfdw_application_name != '\0') This GUC parameter should be set after the options of foreign server are set so that its setting can override the server-level ones. Isn't it better to comment this? +static bool +check_pgfdw_application_name(char **newval, void **extra, GucSource source) +{ + /* Only allow clean ASCII chars in the application name */ + if (*newval) + pg_clean_ascii(*newval); + return true; Do we really need this check hook? Even without that, any non-ASCII characters in application_name would be replaced with "?" in the foreign PostgreSQL server when it's passed to that. On the other hand, if it's really necessary, application_name set in foreign server object also needs to be processed in the same way. + NULL, + PGC_USERSET, + GUC_IS_NAME, Why is GUC_IS_NAME flag necessary? postgres_fdw.application_name overrides application_name set in foreign server object. Shouldn't this information be documented? Isn't it better to have the regression test for this feature? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION