Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Tom Lane wrote:
> >> This is an ugly patch. Why not *one* test of the GUC variable, inside
> >> set_ps_display(), and no side-effects on callers? You would need to
> >> force an initial update from init_ps_display, but that only requires a
> >> small amount of code refactoring inside ps_status.c.
>
> > Consider all the helper processes that set their process title. The
> > only thing I can think of is to add a boolean to set_ps_display() so say
> > whether this is per-command set or not. Is that your idea?
>
> No, that's not what I said at all. Currently init_ps_display doesn't
> actually force the display to update; it's left to the first
> set_ps_display call to do that. If we made init_ps_display update the
> status unconditionally, then set_ps_display could be a conditional
> no-op, and in the helper process setup code
>
> /* Identify myself via ps */
> init_ps_display("autovacuum process", "", "");
> set_ps_display("");
>
> we could remove the now-unnecessary set_ps_display("") calls, but
> the other set_ps_display() calls would stay exactly like they are.
Yea, I figured that out the merge idea after I replied.
If you put a contition test in set_ps_display(), the only clean way to
do this is for init_ps_display() to force update_process_title to true
before we call set_ps_display(), then reset it to its original value,
but that sounds pretty ugly. Do we create another function that
unconditionally sets the title, and conditionally call that from the
set_ps_display()? These seem uglier than the if() test. Or add a
'force' parameter.
--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +