Re: Additional message in pg_terminate_backend

Поиск
Список
Период
Сортировка
От Jim Jones
Тема Re: Additional message in pg_terminate_backend
Дата
Msg-id 7e8c913b-1bfb-41f1-b5db-c29e2af48daa@uni-muenster.de
обсуждение исходный текст
Ответ на Re: Additional message in pg_terminate_backend  (Jim Jones <jim.jones@uni-muenster.de>)
Ответы Re: Additional message in pg_terminate_backend
Список 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);
}





В списке pgsql-hackers по дате отправления: