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.
regards, tom lane