set local statement_timeout within a stored procedure

Started by Abraham, Dannyabout 2 years ago2 messagesgeneral
Jump to latest
#1Abraham, Danny
danny_abraham@bmc.com

Hi,

Is there a way to integrate " set local statement_timeout" in a stored procedure?

Something like ....

create or replace procedure call_sp()
language plpgsql
as $$
begin
set local statement_timeout = 10000;
call sp();
end; $$

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Abraham, Danny (#1)
Re: set local statement_timeout within a stored procedure

"Abraham, Danny" <danny_abraham@bmc.com> writes:

Is there a way to integrate " set local statement_timeout" in a stored procedure?

Not usefully. statement_timeout bounds the time spent for a single
command sent by the client. So by the time you're inside a procedure,
the countdown is already running (or not) for the current command, and
it's too late to change it with effect for that command.

regards, tom lane