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-10-05T16:25:00Z
Lists: pgsql-hackers

On 2021/10/04 21:53, kuroda.hayato@fujitsu.com wrote:
>> 		if (*p == '-' ? isdigit(p[1]) : isdigit(p[0]))
>> 		{
>> 			char *endptr;
>> 			padding = strtol(p, &endptr, 10);
>> 			if (p == endptr)
>> 				break;
>> 			p = endptr;
>> 		}
>> 		else
>> 			padding = 0;
> 
> I removed the support function based on your suggestion,
> but added some if-statement in order to treats the special case: '%-p'.

+		else if (*p == '-' ? isdigit(p[1]) : isdigit(p[0]))
+		{
+			char *endptr;
+			padding = strtol(p, &endptr, 10);

Maybe isdigit() and strtol() work differently depending on locale setting?
If so, I'm afraid that the behavior of this new code would be different from
process_log_prefix_padding().

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.