One thing that occurred to me in this context is that if we store the wait
event information in PGPROC, then can we think of providing the info
about wait events in a separate view pg_stat_waits (or pg_stat_wait_info or
any other better name) where we can display wait information about
all-processes rather than only backends?
Sounds good to me. Consider a logical decoding plugin in a walsender for example.
This will avoid the confusion
about breaking the backward compatibility for the current 'waiting' column
in pg_stat_activity.
I'm about -10^7 on changing the 'waiting' column. I am still seeing confused users from the 'procpid' to 'pid' renaming. If more info is needed, add a column with more detail or, as you suggest here, use a new view.