pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: kuroda.hayato@fujitsu.com <kuroda.hayato@fujitsu.com>
Cc: 'pgsql-hackers@lists.postgresql.org' <pgsql-hackers@lists.postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name)
Date: Thu, 2 Sep 2021 00:40:48 +0900
Message-ID: <0d5df322-c9ad-308e-982b-a3d3275bcdc0@oss.nttdata.com> (raw)
In-Reply-To: <TYAPR01MB5866B697888D5568E6D1546BF5CD9@TYAPR01MB5866.jpnprd01.prod.outlook.com>
References: <TYCPR01MB5870D1E8B949DAF6D3B84E02F5F29@TYCPR01MB5870.jpnprd01.prod.outlook.com>
	<ed1c8ef2-16ac-4e56-d302-b1ff430baeec@oss.nttdata.com>
	<TYAPR01MB58661635D3884E3B863ED01CF5C79@TYAPR01MB5866.jpnprd01.prod.outlook.com>
	<TYAPR01MB5866EF9624D2DFA8A74E5E94F5CC9@TYAPR01MB5866.jpnprd01.prod.outlook.com>
	<8f985ba0-2e79-ab67-4fa4-d35024188047@oss.nttdata.com>
	<TYAPR01MB5866B697888D5568E6D1546BF5CD9@TYAPR01MB5866.jpnprd01.prod.outlook.com>



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





view thread (18+ messages)  latest in thread

Message-ID: <0d5df322-c9ad-308e-982b-a3d3275bcdc0@oss.nttdata.com>
Permalink:  ../0d5df322-c9ad-308e-982b-a3d3275bcdc0@oss.nttdata.com/
Also on:    postgresql.org/message-id/0d5df322-c9ad-308e-982b-a3d3275bcdc0@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, kuroda.hayato@fujitsu.com, pgsql-hackers@lists.postgresql.org, tgl@sss.pgh.pa.us
  Subject: Re: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name)
  In-Reply-To: <0d5df322-c9ad-308e-982b-a3d3275bcdc0@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox