Re: Additional message in pg_terminate_backend

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>, Roman Khapov <rkhapov(at)yandex-team(dot)ru>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Additional message in pg_terminate_backend
Date: 2026-02-01 13:58:32
Message-ID: 7e8c913b-1bfb-41f1-b5db-c29e2af48daa@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/02/2026 01:08, Jim Jones wrote:
> As pointed out by Kirill, there is no reason to create
> pg_terminate_backend_msg or pg_cancel_backend_msg. You can simply use
> the existing functions and expand them to use one extra parameter

Since the message's size is limited to BACKEND_MSG_MAX_LEN, shouldn't
you use it to limit msg at pg_terminate_backend[_msg]()? Something like:

Datum pg_terminate_backend(PG_FUNCTION_ARGS)
{
int pid;
int timeout; /* milliseconds */
char msg[BACKEND_MSG_MAX_LEN];

pid = PG_GETARG_INT32(0);
timeout = PG_GETARG_INT64(1);
text_to_cstring_buffer(PG_GETARG_TEXT_PP(2), msg, sizeof(msg));

return pg_terminate_backend_internal(pid, timeout, msg);
}

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2026-02-01 14:00:00 Re: Improving tracking/processing of buildfarm test failures
Previous Message Florents Tselai 2026-02-01 11:02:37 Re: Patch: Add tsmatch JSONPath operator for granular Full Text Search