]> 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:51:25 +0000 (18:51 +0200)
commitebc53ca7b2ff339a9455ccdc368d39ebb39a0762
treedd7309e560786ed9ec5a6ba19c770a5791879b7f
parentc10535fbea022113e470726b929e47833bcb1626
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