Re: Change pg_cancel_*() to ignore current backend

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, "david(dot)g(dot)johnston(at)gmail(dot)com >> David G Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Subject: Re: Change pg_cancel_*() to ignore current backend
Date: 2015-05-20 23:48:59
Message-ID: 555D1D6B.8080507@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/20/15 11:15 AM, Jon Nelson wrote:
> On Wed, May 20, 2015 at 9:09 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-05-20 23:56:41 Re: Change pg_cancel_*() to ignore current backend
Previous Message Stephen Frost 2015-05-20 23:48:38 Re: Disabling trust/ident authentication configure option