Re: Allow escape in 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>, 'Kyotaro Horiguchi' <horikyota.ntt@gmail.com>
Cc: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, "ikedamsh@oss.nttdata.com" <ikedamsh@oss.nttdata.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>, "tgl@sss.pgh.pa.us" <tgl@sss.pgh.pa.us>
Date: 2021-12-16T06:33:56Z
Lists: pgsql-hackers

On 2021/12/16 11:53, kuroda.hayato@fujitsu.com wrote:
> Dear Fujii-san,
> 
> Thank you for updating! I read your patches and I have
> only one comment.
> 
>> 			if (strcmp(keywords[i], "application_name") == 0 &&
>> 				values[i] != NULL && *(values[i]) != '\0')
> 
> I'm not sure but do we have a case that values[i] becomes NULL
> even if keywords[i] is "application_name"?

No for now, I guess. But isn't it safer to check that, too? I also could not find strong reason why that check should be dropped. But you'd like to drop that?

> I think other parts are perfect.

Thanks for the review! At first I pushed 0001 patch.

BTW, 0002 patch adds the regression test that checks pg_stat_activity.application_name. But three months before, we added the similar test when introducing postgres_fdw.application_name GUC and reverted/removed it because it's not stable [1]. So we should review carefully whether the test 0002 patch adds may have the same issue or not. As far as I read the patch, ISTM that the patch has no same issue. But could you double check that?

[1]
https://postgr.es/m/848ff477-effd-42b9-8b25-3f7cfe289398@oss.nttdata.com

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.