Re: Allow escape in application_name (was: [postgres_fdw] add local pid to fallback_application_name)

Fujii Masao <masao.fujii@oss.nttdata.com>

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>, 'Tom Lane' <tgl@sss.pgh.pa.us>
Date: 2021-09-03T16:54:39Z
Lists: pgsql-hackers

Attachments


On 2021/09/03 14:56, kuroda.hayato@fujitsu.com wrote:
> Dear Fujii-san,
> 
> Thank you for your great works. Attached is the latest version.

Thanks a lot!


> I set four testcases:
> 
> (1) Sets neither GUC nor server option
> (2) Sets server option, but not GUC
> (3) Sets GUC but not server option
> (4) Sets both GUC and server option

OK.


> I confirmed it almost works fine, but I found that
> fallback_application_name will be never used in our test enviroment.
> It is caused because our test runner pg_regress sets PGAPPNAME to "pg_regress" and
> libpq prefer the environment variable to fallback_appname.
> (I tried to control it by \setenv, but failed...)

make check uses "pg_regress", but I guess that make installcheck uses
"postgres_fdw". So the patch would cause make installcheck to fail.
I think that the case (1) is not so important, so can be removed. Thought?

Attached is the updated version of the patch. I removed the test
for case (1). And I arranged the regression tests so that they are based
on debug_discard_caches, to simplify them. Also I added and updated
some comments and docs. Could you review this version?

Regards,

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

Commits

  1. postgres_fdw: Add regression test for postgres_fdw.application_name GUC.

  2. postgres_fdw: Allow postgres_fdw.application_name to include escape sequences.

  3. doc: Add note about postgres_fdw.application_name.

  4. postgres_fdw: Revert unstable tests for postgres_fdw.application_name.

  5. postgres_fdw: Allow application_name of remote connection to be set via GUC.