Re: Change pg_cancel_*() to ignore current backend

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Eric Ridge <e_ridge(at)tcdi(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Change pg_cancel_*() to ignore current backend
Date: 2015-05-22 20:49:58
Message-ID: 555F9676.6030206@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/22/15 3:08 PM, Eric Ridge 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.
> I'm just a lurker, but regularly get bitten by this exact thing.
>
> Rather than change the behavior of pg_cancel/terminate_backend(), why not change pg_stat_activity to exclude the current session? Seems like showing a row in pg_stat_activity for "SELECT * FROM pg_stat_activity" is kinda useless anyways.

Interesting idea. I suspect that would be even more invasive than
modifying the functions though...
--
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 Jim Nasby 2015-05-22 20:59:35 Re: jsonb concatenate operator's semantics seem questionable
Previous Message Eric Ridge 2015-05-22 20:08:40 Re: Change pg_cancel_*() to ignore current backend