Re: Additional message in pg_terminate_backend

Roman Khapov <rkhapov@yandex-team.ru>

From: Roman Khapov <rkhapov@yandex-team.ru>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Kirill Reshke <reshkekirill@gmail.com>, Daniel Gustafsson <daniel@yesql.se>, pgsql-hackers@lists.postgresql.org
Date: 2026-02-03T07:52:57Z
Lists: pgsql-hackers

Attachments

Hi Jim!
Thanks for your review and rebase!

> 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:
> 

The message is truncated inside BackendMsgSet function, so I see a little
point in truncating it at pg_terminate_backend..

Also, changing the stpncpy() to strlcpy() breaks the logic
of returning result length of the message and NOTICE message about it,
so I reverted this change. But this note make me think about adding test
to truncation logic, so I added it in v4.

--
Best regards,
Roman Khapov