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 21:36:34 +0900
Message-ID: <2dde164d-bc49-b3ca-0cc1-1c5fe40f0886@oss.nttdata.com> (raw)
In-Reply-To: <TYAPR01MB5866A3CAE041F7B05E2EE3A9F5CE9@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>
	<0d5df322-c9ad-308e-982b-a3d3275bcdc0@oss.nttdata.com>
	<TYAPR01MB5866A3CAE041F7B05E2EE3A9F5CE9@TYAPR01MB5866.jpnprd01.prod.outlook.com>



On 2021/09/02 18:27, kuroda.hayato@fujitsu.com wrote:
> I added the following comments:
> 
> ```diff
> -               /* Use "postgres_fdw" as fallback_application_name. */
> +               /*
> +                * Use pgfdw_application_name as application_name.
> +                *
> +                * Note that this check must be behind constructing generic options
> +                * because pgfdw_application_name has higher priority.
> +                */
> ```

Thanks! What about updating the comments furthermore as follows?

---------------------------------
Use pgfdw_application_name as application_name if set.

PQconnectdbParams() processes the parameter arrays from start to end.
If any key word is repeated, the last value is used. Therefore note that
pgfdw_application_name must be added to the arrays after options of
ForeignServer are, so that it can override application_name set in
ForeignServer.
---------------------------------

> Attached is the fixed version. 0002 will be rebased later.

Thanks for updating the patch!

+		}
+		/* Use "postgres_fdw" as fallback_application_name */

It's better to add new empty line between these two lines.

+-- Disconnect once because the value is used only when establishing connections
+DO $$
+	BEGIN
+		PERFORM postgres_fdw_disconnect_all();
+	END
+$$;

Why does DO command need to be used here to execute
postgres_fdw_disconnect_all()? Instead, we can just execute
"SELECT 1 FROM postgres_fdw_disconnect_all();"?

For test coverage, it's better to test at least the following three cases?

(1) appname is set in neither GUC nor foreign server
        -> "postgres_fdw" set in fallback_application_name is used
(2) appname is set in foreign server, but not in GUC
        -> appname in foreign server is used
(3) appname is set both in GUC and foreign server
       -> appname in GUC is used

+SELECT FROM ft1 LIMIT 1;

"1" should be added just after SELECT in the above statement?
Because postgres_fdw regression test basically uses "SELECT 1 FROM ..."
in other places.

+	DefineCustomStringVariable("postgres_fdw.application_name",
+							   "Sets the application name. This is used when connects to the remote server.",

What about simplifying this description as follows?

---------------
Sets the application name to be used on the remote server.
---------------

+  <title> Configuration Parameters </title>
+  <variablelist>

The empty characters just after <title> and before </title> should be removed?


Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION





view thread (18+ messages)  latest in thread

Message-ID: <2dde164d-bc49-b3ca-0cc1-1c5fe40f0886@oss.nttdata.com>
Permalink:  ../2dde164d-bc49-b3ca-0cc1-1c5fe40f0886@oss.nttdata.com/
Also on:    postgresql.org/message-id/2dde164d-bc49-b3ca-0cc1-1c5fe40f0886@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: <2dde164d-bc49-b3ca-0cc1-1c5fe40f0886@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