On 6/8/18, 2:21 PM, "Andres Freund" <and...@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... }