Re: [HACKERS] Optional message to user when terminating/cancelling backend - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: [HACKERS] Optional message to user when terminating/cancelling backend
Date
Msg-id 9D842953-1B69-43D6-8C06-7797E2F1095A@yesql.se
Whole thread Raw
In response to Re: [HACKERS] Optional message to user when terminating/cancelling backend  (Eren Başak <eren@citusdata.com>)
Responses Re: [HACKERS] Optional message to user when terminating/cancellingbackend  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
> On 27 Mar 2018, at 13:50, Eren Başak <eren@citusdata.com> wrote:

> > pg_cancel_backend() is defined proisstrict, while pg_cancel_backend_msg() is
> > not.  I think we must be able to perform the cancellation if the message is
> > NULL, so made it two functions.
>
> I agree that we should preserve the old usage as well. What I don't understand is that, can't we remove proisstrict
frompg_cancel_backend and copy the body of pg_cancel_backend_msg into pg_cancel_backend. This way, I think we can
accomplishthe same thing without introducing two new functions. 

If we do that, wouldn’t SELECT pg_cancel_backend(NULL) fail unless NULL is
explicitly casted to integer?  Also, I think that would cause make check to
fail the opr_sanity suite on the “multiple uses of the same internal function”
test.  Maybe I’m misunderstanding your point here?

> pg_terminate_backend_msg errors out if the pid is null but pg_cancel_backend_msg returns null and I think we should
haveconsistency between these two in this regard. 

Absolutely, that was an oversight in the v8 patch, they should both handle NULL
in the same way.

Whitespace and null handling fixed, as well as rebased over HEAD.

cheers ./daniel


Attachment

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Allow workers to override datallowconn
Next
From: David Steele
Date:
Subject: Re: PATCH: Configurable file mode mask