Re: Change pg_cancel_*() to ignore current backend

From: Andres Freund <andres(at)anarazel(dot)de>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Eric Ridge <e_ridge(at)tcdi(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Change pg_cancel_*() to ignore current backend
Date: 2015-05-22 22:35:39
Message-ID: 20150522223539.GO2028@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-05-22 17:29:03 -0500, Jim Nasby wrote:
> On 5/22/15 4:51 PM, Tom Lane wrote:
> >Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> >>On 5/22/15 3:08 PM, Eric Ridge wrote:
> >>>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...
> >
> >-1 ... some other columns in pg_stat_activity are potentially useful even
> >for the current session, eg session and transaction start times.
>
> AFAICT the only field you can get in pg_stat_activity and nowhere else is
> session start time (txn start is always now(), no?).
>
> If that's the only objection about eliminating the current backend from
> pg_stat_activity then I'd say we should just add a session_start_time
> function to handle that.

That's far too big a backward compat break for something of very minor
benefit.

This whole discussion seems to be about making it easier to run SELECT
pg_cancel_backend(pid) FROM pg_stat_activity;. But that shouldn't be
made easier! If anything harder.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-05-22 22:43:50 Re: Change pg_cancel_*() to ignore current backend
Previous Message Jim Nasby 2015-05-22 22:29:03 Re: Change pg_cancel_*() to ignore current backend