Bruce Momjian <pgman@candle.pha.pa.us> writes:
> You are asking if a funciton itself might want to set query cancel and
> catch the cancel and do something else?
Exactly. There's a proof-of-concept test at the bottom of
regress/sql/plpgsql.sql, wherein a function gets control back
from a query that would have run for an unreasonably long time.
regards, tom lane