Re: pl/tcl function to detect when a request has been canceled - Mailing list pgsql-hackers

From Peter Da Silva
Subject Re: pl/tcl function to detect when a request has been canceled
Date
Msg-id 91E0AE11-E371-40DE-8FE7-CBE50932D2D1@flightaware.com
Whole thread Raw
In response to Re: pl/tcl function to detect when a request has been canceled  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 6/8/18, 2:21 PM, "Andres Freund" <andres@anarazel.de> wrote:
    Not sure I quite understand what you mean. You're thinking of the case
    where you're processing rows one-by-one with a cursor? Or that a single
    spi call takes a long while to process the query?

The former, I believe. One example (lightly obfuscated):

spi_exec -array a "SELECT this,that from table where stuff..." {
    if {$use_cancel_pending && [cancel_pending]} {
        error "cancelled in ..."
    }
    do_something_with_array a
    more_business_code_here
    and_so_on...
}


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pl/tcl function to detect when a request has been canceled
Next
From: Steve Atkins
Date:
Subject: Compromised postgresql instances