Re: Allow escape in application_name

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, "ikedamsh(at)oss(dot)nttdata(dot)com" <ikedamsh(at)oss(dot)nttdata(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Allow escape in application_name
Date: 2021-12-28 06:29:21
Message-ID: 341f2580-1342-a39d-6c54-7b5f0402bb14@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/12/28 9:32, Masahiko Sawada wrote:
> Doesn't this query return 64? So the expression "substring(str for
> (SELECT max_identifier_length FROM pg_control_init()))" returns the
> first 64 characters of the given string while the application_name is
> truncated to be 63 (NAMEDATALEN - 1) characters. It also seems to be
> fine to use current_setting('max_identifier_length') instead of
> max_identifier_length of pg_control_init().

Interesting! I agree that current_setting('max_identifier_length') should be used instead. Attached is the updated version of the patch. It uses current_setting('max_identifier_length').

BTW it seems confusing that pg_control_init() (also pg_controldata) and GUC report different values as max_identifier_length. Probably they should return the same value such as NAMEDATALEN - 1. But this change might be overkill...

Regards,

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

Attachment Content-Type Size
pgfdw_appname_regression_test_v2.patch text/plain 4.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2021-12-28 06:56:22 Re: sequences vs. synchronous replication
Previous Message Zhihong Yu 2021-12-28 03:19:31 Re: Add Boolean node