]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix pg_stat_get_backend_wait_event() for aux processes
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 11 Feb 2026 16:50:57 +0000 (18:50 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 11 Feb 2026 16:50:57 +0000 (18:50 +0200)
commit78a5e3074b824b4bbcb75ea4dd565ce735f54293
tree5bb1cd7a135634b96e67aff1573314c4416a7709
parent1d92e0c2cc4789255c630d8776bbe85ca9ebc27f
Fix pg_stat_get_backend_wait_event() for aux processes

The pg_stat_activity view shows information for aux processes, but the
pg_stat_get_backend_wait_event() and
pg_stat_get_backend_wait_event_type() functions did not. To fix, call
AuxiliaryPidGetProc(pid) if BackendPidGetProc(pid) returns NULL, like
we do in pg_stat_get_activity().

In version 17 and above, it's a little silly to use those functions
when we already have the ProcNumber at hand, but it was necessary
before v17 because the backend ID was different from ProcNumber. I
have other plans for wait_event_info on master, so it doesn't seem
worth applying a different fix on different versions now.

Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://www.postgresql.org/message-id/c0320e04-6e85-4c49-80c5-27cfb3a58108@iki.fi
Backpatch-through: 14
src/backend/utils/adt/pgstatfuncs.c