Re: pgsql: psql: Add test for query canceling

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: psql: Add test for query canceling
Date: 2021-08-23 11:12:28
Message-ID: F8E93259-D461-48DB-B572-D5FCE66CBC6F@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

> On 21 Aug 2021, at 00:40, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
>> On 20 Aug 2021, at 20:47, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> I think you should drop the overly-cute bit with a SIGALRM handler,
>>> and instead have a loop-with-delay around an attempt to read the
>>> psql.pid file, after launching the psql run without an immediate
>>> wait for termination.
>
>> This could perhaps be done with a PostgresNode::interactive_psql
>> session?
>
> Yeah, we do have that infrastructure available in the
> 010_tab_completion.pl test.

In order to satisfy my own curiosity I decided to take a stab at this which
turned into the attached. I wasn’t able to reliably know that the pg_sleep
query had started except letting the timer expire, but that may very well be
the rust on my Perl skills showing.

Not sure if this moves the needle on this in either direction, but I figured I
should report back progress either way.

--
Daniel Gustafsson https://vmware.com/

Attachment Content-Type Size
psql_query_cancel_test.patch application/octet-stream 3.4 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2021-08-23 16:34:08 pgsql: Improve defaults shown in postgresql.conf.sample and pg_settings
Previous Message Dilip Kumar 2021-08-23 09:43:19 Re: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)