Re: Optional message to user when terminating/cancelling backend

Michael Paquier <michael.paquier@gmail.com>

From: Michael Paquier <michael.paquier@gmail.com>
To: Daniel Gustafsson <daniel@yesql.se>
Cc: Yugo Nagata <nagata@sraoss.co.jp>, PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-06-22T00:24:54Z
Lists: pgsql-hackers
On Wed, Jun 21, 2017 at 11:42 PM, Daniel Gustafsson <daniel@yesql.se> wrote:
> The message is truncated in SetBackendCancelMessage() for safety, but
> pg_{cancel|terminate}_backend() could throw an error on too long message, or
> warning truncation, to the caller as well.  Personally I think a warning is the
> appropriate response, but I don’t really have a strong opinion.

And a NOTICE? That's what happens for relation name truncation. You
are right that having a check in SetBackendCancelMessage() makes the
most sense as bgworkers could just call the low level API. Isn't the
concept actually closer to just a backend message? This slot could be
used for other purposes than cancellation.
-- 
Michael


Commits

  1. Refactor user-facing SQL functions signalling backends

  2. Introduce 64-bit hash functions with a 64-bit seed.