"Abraham, Danny" <danny_abraham(at)bmc(dot)com> writes:
> 2021-04-09 08:00:08.692 IDTERROR: canceling statement due to statement timeout
I don't know why you would think that a statement timeout is somehow
the fault of the refcursor variable you used. You need to look at
whether your timeout is a sane value, and if so, why it is that
something else is blocking your query for longer than that.
Looking into pg_locks might help identify what the "something else"
is.
regards, tom lane