Add errdetail() with PID and UID about source of termination signal. When a backend is terminated via pg_terminate_backend() or an external SIGTERM, the error message now includes the sender's PID and UID as errdetail, making it easier to identify the source of unexpected terminations in multi-user environments.
On platforms that support SA_SIGINFO (Linux, FreeBSD, and most modern Unix systems), the signal handler captures si_pid and si_uid from the siginfo_t structure. On platforms without SA_SIGINFO, the detail is simply omitted. Author: Jakub Wartak <[email protected]> Reviewed-by: Andrew Dunstan <[email protected]> Reviewed-by: Chao Li <[email protected]> Discussion: https://postgr.es/m/cakzirmyrowovzsdixpld3pgmqxuql_zw2ght5xhhckq1uds...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/55890a919454a2165031a04b175ca92e3ed70e69 Modified Files -------------- configure | 42 +++++++++++++++++++++++++++++++++++++++ configure.ac | 18 +++++++++++++++++ meson.build | 4 ++++ src/backend/replication/syncrep.c | 14 ++++++++++++- src/backend/tcop/postgres.c | 34 ++++++++++++++++++++++++------- src/backend/utils/init/globals.c | 2 ++ src/bin/psql/t/001_basic.pl | 7 +++---- src/include/miscadmin.h | 2 ++ src/include/pg_config.h.in | 3 +++ src/port/pqsignal.c | 35 +++++++++++++++++++++++++++++--- 10 files changed, 146 insertions(+), 15 deletions(-)
