From 070d5a9a761cd1d53411b82e4e469203c2c76372 Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Fri, 27 Nov 2020 07:53:33 +0530 Subject: [PATCH v1] Improve error message in ProcessInterrupts for bg workers Shutdown of a bg worker currently produces a message "terminating connection due to administrator command" which is confusing, because it is not a connection. So, improve the message for bg worker in ProcessInterrupts(). --- src/backend/tcop/postgres.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 34ed0e7558..7d7a7e0801 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -3072,6 +3072,11 @@ ProcessInterrupts(void) errmsg("terminating connection due to conflict with recovery"), errdetail_recovery_conflict())); } + else if (IsBackgroundWorker) + ereport(FATAL, + (errcode(ERRCODE_ADMIN_SHUTDOWN), + errmsg("terminating background worker \"%s\" due to administrator command", + MyBgworkerEntry->bgw_type))); else ereport(FATAL, (errcode(ERRCODE_ADMIN_SHUTDOWN), -- 2.25.1