Re: Allow escape in application_name

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: masao(dot)fujii(at)oss(dot)nttdata(dot)com, kuroda(dot)hayato(at)fujitsu(dot)com, houzj(dot)fnst(at)fujitsu(dot)com, ikedamsh(at)oss(dot)nttdata(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, tgl(at)sss(dot)pgh(dot)pa(dot)us
Subject: Re: Allow escape in application_name
Date: 2022-01-04 03:36:32
Message-ID: CAD21AoBGD2X_ZixPA+rWfBtVdrNA6UpUYCjDzb0Xog0dpfWm7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 4, 2022 at 12:05 PM Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> wrote:
>
> At Wed, 29 Dec 2021 10:34:31 +0900, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote in
> > On Tue, Dec 28, 2021 at 3:29 PM Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> wrote:
> > >
> > >
> > >
> > > 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').
> >
> > Thank you for updating the patch! It looks good to me.
>
> pg_terminate_backend returns just after kill() returns. So I'm afraid
> that there's a case where the next access to ft6 happens before the
> old connection actually ends on slow machines or under heavy load.

The test does pg_terminate_backend() with a timeout, and in this case,
don't we wait for the backend to end after sending the signal?

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message wenjing zeng 2022-01-04 03:46:45 Re: why does reindex invalidate relcache without modifying system tables
Previous Message Masahiko Sawada 2022-01-04 03:30:06 Re: [HACKERS] logical decoding of two-phase transactions