On Tue, Dec 28, 2021 at 8:57 AM kuroda.hay...@fujitsu.com <kuroda.hay...@fujitsu.com> wrote: > > Dear Sawada-san, > > > If so, we need to do substring(... for > > 63) instead.
Just to be clear, I meant substring(... for NAMEDATALEN - 1). > > Yeah, the parameter will be truncated as one less than NAMEDATALEN: > > ``` > max_identifier_length (integer) > Reports the maximum identifier length. It is determined as one less than the > value of NAMEDATALEN when building the server. > The default value of NAMEDATALEN is 64; therefore the default > max_identifier_length is 63 bytes, > which can be less than 63 characters when using multibyte encodings. > ``` I think this is the description of the max_identifier_length GUC parameter. > > But in Fujii-san's patch length is picked up by the following SQL, so I think > it works well. > > ``` > SELECT max_identifier_length FROM pg_control_init() > ``` 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(). Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/