pgsql: Fix pg_stat_get_backend_wait_event() for aux processes - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Fix pg_stat_get_backend_wait_event() for aux processes
Date
Msg-id E1vqDZi-000De2-2e@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/84247333792ce03c69659104b5ff68354a2c88f7

Modified Files
--------------
src/backend/utils/adt/pgstatfuncs.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)


pgsql-committers by date:

Previous
From: Nathan Bossart
Date:
Subject: pgsql: Add password expiration warnings.
Next
From: Tom Lane
Date:
Subject: pgsql: Fix plpgsql's handling of "return simple_record_variable".