Re: Make set_ps_display faster and easier to use - Mailing list pgsql-hackers

From David Rowley
Subject Re: Make set_ps_display faster and easier to use
Date
Msg-id CAApHDvrx-kwtWFaO8_hxS5fBYeAe-Rp0YWATZSwBJx8UVu9bJA@mail.gmail.com
Whole thread Raw
In response to Re: Make set_ps_display faster and easier to use  (Andres Freund <andres@anarazel.de>)
Responses Re: Make set_ps_display faster and easier to use
List pgsql-hackers
Thank you for having a look at this.

On Fri, 17 Feb 2023 at 14:01, Andres Freund <andres@anarazel.de> wrote:
> > +set_ps_display_suffix(const char *suffix)
> > +{
> > +     size_t  len;
>
> Think this will give you an unused-variable warning in the PS_USE_NONE case.

Fixed

> > +#ifndef PS_USE_NONE
> > +     /* update_process_title=off disables updates */
> > +     if (!update_process_title)
> > +             return;
> > +
> > +     /* no ps display for stand-alone backend */
> > +     if (!IsUnderPostmaster)
> > +             return;
> > +
> > +#ifdef PS_USE_CLOBBER_ARGV
> > +     /* If ps_buffer is a pointer, it might still be null */
> > +     if (!ps_buffer)
> > +             return;
> > +#endif
>
> This bit is now repeated three times. How about putting it into a helper?

Good idea. Done.

> > +set_ps_display_internal(void)
>
> Very very minor nit: Perhaps this should be update_ps_display() or
> flush_ps_display() instead?

I called the precheck helper update_ps_display_precheck(), so went
with flush_ps_display() for updating the display so they both didn't
start with "update".

Updated patch attached.

David

Attachment

pgsql-hackers by date:

Previous
From: Katsuragi Yuta
Date:
Subject: Re: [Proposal] Add foreign-server health checks infrastructure
Next
From: Etsuro Fujita
Date:
Subject: Doc: Improve note about copying into postgres_fdw foreign tables in batch