Michael Paquier <michael.paqu...@gmail.com> writes: > I was the one suggesting to Fabrizio to look at how backend types are > evaluated in pgstat.c after an off-list discussion. Agreed that this > result is fragile as this makes two places dependent on the process > types. Why not simply moving all the business of pgstat_bestart() > evaluating which st_backendType to use into a common routine and have > pgstat.c and have this utility use this API? pgstat.h already includes > BackendType as an enum to use so this could live with a routine > available in pgstat.c. Or would it be cleaner to have a new thing > dedicated to process-related information, say as > src/backend/utils/misc/process_info.c? It is indeed strange to have a > session-related feature depend on something with statistics.
This is really about consolidating a whole bunch of ad-hoc stuff. I don't think pgstat has any particular pride of place here. It should be one consumer of a common API. The stuff related to AuxProcType is in miscadmin.h, so one possibility is to put the new enum there. But I could see inventing a whole new header for this, "utils/proctype.h" or so. regards, tom lane