Re: pl/tcl function to detect when a request has been canceled

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pl/tcl function to detect when a request has been canceled
Дата
Msg-id 20180608181253.43sn7qw7zanv4vkb@alap3.anarazel.de
обсуждение исходный текст
Ответ на pl/tcl function to detect when a request has been canceled  (Peter Da Silva <peter.dasilva@flightaware.com>)
Ответы Re: pl/tcl function to detect when a request has been canceled  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pl/tcl function to detect when a request has been canceled  (Peter Da Silva <peter.dasilva@flightaware.com>)
Re: pl/tcl function to detect when a request has been canceled  (Peter Da Silva <peter.dasilva@flightaware.com>)
Список pgsql-hackers
Hi,

On 2018-06-08 18:08:14 +0000, Peter Da Silva wrote:
> We have occasional need to run very long-running pl/tcl scripts. If
> the request is cancelled (say, by the user hitting ^c in psql) the
> server-side script still runs to completion.

> 
> There is a C-level variable QueryCancelPending that can be used to
> monitor for this case, but it’s not visible at the pl/tcl scripting
> level. This is a simple new command that returns the current state of
> this variable to Tcl.
> 
> We are currently maintaining a fork of pl/tcl at
> https://github.com/flightaware/pltcl that has this mod, but it would
> be useful to get the functionality into mainline PostgreSQL.

I'm not terribly opposed to this, but I wonder if the much more
pragmatic solution is to just occasionally call a database function that
checks this?  You could just run SELECT 1 occasionally :/

- Andres


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Performance regression with PostgreSQL 11 and partitioning
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Needless additional partition check in INSERT?