Re: Change pg_cancel_*() to ignore current backend

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Change pg_cancel_*() to ignore current backend
Date: 2015-05-20 01:05:46
Message-ID: 555BDDEA.3040300@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/19/15 6:30 PM, David G. Johnston wrote:
> On Tue, May 19, 2015 at 4:23 PM, Marko Tiikkaja <marko(at)joh(dot)to
> <mailto:marko(at)joh(dot)to>>wrote:
>
> On 2015-05-20 00:59, Jim Nasby wrote:
>
> I find it annoying to have to specifically exclude
> pg_backend_pid() from
> pg_stat_activity if I'm trying to kill a bunch of backends at
> once, and
> I can't think of any reason why you'd ever want to call a
> pg_cancel_*
> function with your own PID.
>
>
> That's a rather easy way of testing that you're handling FATAL
> errors correctly from a driver/whatever.
>
>
> I'm having trouble thinking of a PC name for the function we create that
> should do this; while changing the pg_cancel_* functions to operate more
> safely.

We could add a second parameter to the current functions: allow_own_pid
DEFAULT false. To me that seems better than an entirely separate set of
functions.
--
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 Kyotaro HORIGUCHI 2015-05-20 02:06:02 Re: upper planner path-ification
Previous Message Peter Geoghegan 2015-05-20 00:12:43 Re: INSERT ... ON CONFLICT DO UPDATE with _any_ constraint