Re: Support escape sequence for cluster_name in postgres_fdw.application_name

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Support escape sequence for cluster_name in postgres_fdw.application_name
Date: 2022-01-27 10:26:39
Message-ID: b4cb3b76-903f-50fe-7dc2-b37d851e7b56@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022/01/27 17:10, Kyotaro Horiguchi wrote:
> At Tue, 25 Jan 2022 16:02:39 +0900, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)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 what character 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 tell me where the patch should update?

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergey Dudoladov 2022-01-27 10:43:26 Re: Add connection active, idle time to pg_stat_activity
Previous Message Sergey Dudoladov 2022-01-27 09:53:32 Re: Is there a way (except from server logs) to know the kind of on-going/last checkpoint?