Re: Support escape sequence for cluster_name in postgres_fdw.application_name - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Support escape sequence for cluster_name in postgres_fdw.application_name
Date
Msg-id b4cb3b76-903f-50fe-7dc2-b37d851e7b56@oss.nttdata.com
Whole thread Raw
In response to Re: Support escape sequence for cluster_name in postgres_fdw.application_name  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses RE: Support escape sequence for cluster_name in postgres_fdw.application_name
Re: Support escape sequence for cluster_name in postgres_fdw.application_name
List pgsql-hackers

On 2022/01/27 17:10, Kyotaro Horiguchi wrote:
> At Tue, 25 Jan 2022 16:02:39 +0900, Fujii Masao <masao.fujii@oss.nttdata.com> wrote in
>> Hi,
>>
>> Commit 6e0cb3dec1 allowed postgres_fdw.application_name to include
>> escape sequences %a (application name), %d (database name), %u (user
>> name) and %p (pid). In addition to them, I'd like to support the
>> escape sequence (e.g., %C) for cluster name there. This escape
>> sequence is helpful to investigate where each remote transactions came
>> from. Thought?
>>
>> Patch attached.
> 
> I don't object to adding more meaningful replacements, but more escape
> sequence makes me anxious about the increased easiness of exceeding
> the size limit of application_name.

If this is really an issue, it might be time to reconsider the size limit of application_name. If it's considered too
short,the patch that enlarges it should be proposed separately.
 

>  Considering that it is used to
> identify fdw-initinator server, we might need to add padding (or
> rather truncating) option in the escape sequence syntax, then warn
> about truncated application_names for safety.

I failed to understand this. Could you tell me why we might need to add padding option here?

> Is the reason for 'C' in upper-case to avoid possible conflict with
> 'c' of log_line_prefix?

Yes.

> I'm not sure that preventive measure is worth
> doing.  Looking the escape-sequence spec alone, it seems to me rather
> strange that an upper-case letter is used in spite of its lower-case
> is not used yet.

I have no strong opinion about using %C. If there is better character for the escape sequence, I'm happy to use it. So
whatcharacter is more proper? %c?
 

> Otherwise all looks fine to me except the lack of documentation.

The patch updated postgres-fdw.sgml, but you imply there are other documents that the patch should update? Could you
tellme where the patch should update?
 

Regards,

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



pgsql-hackers by date:

Previous
From: Sergey Dudoladov
Date:
Subject: Re: Is there a way (except from server logs) to know the kind of on-going/last checkpoint?
Next
From: Sergey Dudoladov
Date:
Subject: Re: Add connection active, idle time to pg_stat_activity