Re: Change pg_cancel_*() to ignore current backend - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: Change pg_cancel_*() to ignore current backend
Date
Msg-id 555D1D6B.8080507@BlueTreble.com
Whole thread Raw
In response to Re: Change pg_cancel_*() to ignore current backend  (Jon Nelson <jnelson+pgsql@jamponi.net>)
Responses Re: Change pg_cancel_*() to ignore current backend
List pgsql-hackers
On 5/20/15 11:15 AM, Jon Nelson wrote:
> On Wed, May 20, 2015 at 9:09 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>
>> I think backwards compatibility probably trumps that argument.  I have
>> no objection to providing a different call that behaves this way, but
>> changing the behavior of existing applications will face a *much*
>> higher barrier to acceptance.  Especially since a real use-case for
>> the current behavior was shown upthread, which means you can't argue
>> that it's simply a bug.
>>
>>                          regards, tom lane
>
>
> Agree.
> It breaks backwards compatibility. I use this function a fair bit to
> terminate the current backend all the time.

Could you elaborate on your use case for doing that?

Echoing David's comment elsewhere, I suspect non-developers won't have a 
use for self-termination. I don't see how self-cancel even makes sense, 
and generally if you want to terminate the connection there's easier 
ways to do that then "SELECT pg_terminate_backend(pg_backend_pid())".

I certainly don't want to cause pain for developers, but is this really 
that common?

BTW, if someone had an awesome idea for a new function name then we 
could just go that route. I can't think of anything better than 
pg_*_session. Though, I guess we could do pg_terminate_session and 
pg_cancel_query, which wouldn't be horrid.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Disabling trust/ident authentication configure option
Next
From: Andres Freund
Date:
Subject: Re: Change pg_cancel_*() to ignore current backend