Re: Allow escape in application_name - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Allow escape in application_name
Date
Msg-id 3feb44e8-0bee-01bf-986b-75cafa0d506e@oss.nttdata.com
Whole thread Raw
In response to RE: Allow escape in application_name  ("kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>)
Responses RE: Allow escape in application_name
List pgsql-hackers

On 2021/09/09 21:36, kuroda.hayato@fujitsu.com wrote:
> In this case, I expected to use fallback_application_name instead of appname,
> but I missed the case where appname was set as a server option.
> Maybe we should do continue when buf.data is \0.

Yes.

+                /*
+                 * If the input format is wrong and the string becomes '\0',
+                 * this parameter is no longer used.
+                 * We conitnue searching application_name.
+                 */
+                if (values[i] == '\0')
+                    continue;
+                else
+                    break;

We can simplify the code as follows.

     if (values[i] != '\0')
         break;

> Yeah, and I found that "%+5p" is another example.
> Our padding function does not understand plus sign
> (and maybe this is the specification of printf()), but strtol() reads.
> 
> I did not fix here because I lost my way. Do we treats these cases
> and continue to use strtol(), or use process_padding()?

IMO it's better to use process_padding() to process log_line_prefix and
postgres_fdw.application in the same way as possible.
Which would be less confusing.

Regards,

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: refactoring basebackup.c
Next
From: Michael Paquier
Date:
Subject: Re: Add jsonlog log_destination for JSON server logs