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-01T05:13:13Z
Lists: pgsql-hackers

On 2021/08/31 16:11, kuroda.hayato@fujitsu.com wrote:
> Dear Fujii-san,
> 
> I attached new version, that almost all codes
> moved from libpq to postgres_fdw.

Thanks for updating the patch!

Can we split the patch into two as follows? If so, we can review
and commit them one by one.

#1. Add application_name GUC into postgres_fdw
#2. Allow to specify special escape characters in application_name that postgres_fdw uses.


> 
> Now we can accept four types of escapes.
> All escapes will be rewritten to connection souce's information:
> 
> * application_name,
> * user name,
> * database name, and
> * backend's pid.

+1


> 
> These are cannot be set by log_line_prefix, so I think it is useful.
> 
> 
> We can use escape sequences in two ways:
> * Sets postgres_fdw.application_name GUC paramter, or
> * Sets application_name option in CREATE SERVER command.

OK.


> 
> Which version do you like?

For now I've not found real use case that implementing the feature
in libpq would introduce. So IMO postgres_fdw version is better.

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.