BUG #15747: Help says 'application_name' property supports 64 characters in a standard built but it's only 63

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG #15747: Help says 'application_name' property supports 64 characters in a standard built but it's only 63

PG Bug reporting form
The following bug has been logged on the website:

Bug reference:      15747
Logged by:          Tobias Gierke
Email address:      [hidden email]
PostgreSQL version: 11.2
Operating system:   CentOS 7 (PG 11.2 compiled from sources)
Description:        

According to
https://www.postgresql.org/docs/current/runtime-config-logging.html
'application_name' can be up 64 characters long:

"The application_name can be any string of less than NAMEDATALEN characters
(64 characters in a standard build)."

We tried to set a longer application name - PostgreSQL actually truncates
the name to 63 characters (probably because of the terminating 0-byte taking
up the 64th slot).

db=# set
application_name='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
will be truncated to
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
SET
db=# select
length('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
 length
--------
     63
(1 row)

db=# select '>' || application_name || '<' from pg_stat_activity where
application_name like 'xxx%';
                             ?column?                              
-------------------------------------------------------------------
 >xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<
(1 row)

db=# select
length('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
 length
--------
     63
(1 row)

Reply | Threaded
Open this post in threaded view
|

Re: BUG #15747: Help says 'application_name' property supports 64 characters in a standard built but it's only 63

Sergei Kornilov
Hi

> According to
> https://www.postgresql.org/docs/current/runtime-config-logging.html
> 'application_name' can be up 64 characters long:
>
> "The application_name can be any string of less than NAMEDATALEN characters
> (64 characters in a standard build)."

Less than 64. Not "less or equals"
Doc is correct,  application_name should be less than NAMEDATALEN, so maximun possible value is NAMEDATALEN - 1 characters (well, bytes)

regards, Sergei


Reply | Threaded
Open this post in threaded view
|

Re: BUG #15747: Help says 'application_name' property supports 64 characters in a standard built but it's only 63

Tobias Gierke
Hi Sergei,


Of course you're right. Sorry for the noise.

Cheers,
Tobias

> Hi
>
>> According to
>> https://www.postgresql.org/docs/current/runtime-config-logging.html
>> 'application_name' can be up 64 characters long:
>>
>> "The application_name can be any string of less than NAMEDATALEN characters
>> (64 characters in a standard build)."
> Less than 64. Not "less or equals"
> Doc is correct,  application_name should be less than NAMEDATALEN, so maximun possible value is NAMEDATALEN - 1 characters (well, bytes)
>
> regards, Sergei