Subject: Re: psql help

From: "David G. Johnston" <[email-masked]>
Date: Thu, 4 Jul 2024 22:19:35 -0700

The convention here is to in-line replies, or bottom-post.  Top-posting
makes the archives more difficult to read.

On Thursday, July 4, 2024, Murthy Nunna <[email-masked]> wrote:

> pg_terminate_backend(pid) will not work as it expects only one pid at a
> time.
>
>
> Interesting…I wouldn’t expect the function calls to interact that
way…maybe try putting the select query into a plpgsql DO command loop and
then call pg_terminate_backend once per loop iteration.

> So, the question is how to rewrite this psql so it loops through all pids
> one pid at a time?
>
> I can’t tell if you really mean the psql program or are misusing the term
to mean something different…the code you wrote doesn’t seem like it would
execute in psql.

David J.

---

From: Tom Lane <[email-masked]>
Date: Fri, 05 Jul 2024 01:31:36 -0400

> way

TBH, my reaction to that was that the OP doesn't understand SQL
semantics.  As you previously said, simply removing the LIMIT clause
should work fine.  (The ORDER BY looks kinda pointless, too, unless
there are operational constraints we weren't told about.)

There is a question of exactly what "$a'${TIMEOUT_MINS}'$a"
is supposed to mean, but that's independent of the LIMIT issue.

			regards, tom lane