pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedset local statement_timeout within a stored procedure
2+ messages / 2 participants
[nested] [flat]
* set local statement_timeout within a stored procedure
@ 2024-03-19 12:59 Abraham, Danny <danny_abraham@bmc.com>
0 siblings, 1 reply; 2+ messages in thread
From: Abraham, Danny @ 2024-03-19 12:59 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>; +Cc: Abraham, 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; $$
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: set local statement_timeout within a stored procedure
@ 2024-03-19 13:40 Tom Lane <tgl@sss.pgh.pa.us>
parent: Abraham, Danny <danny_abraham@bmc.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2024-03-19 13:40 UTC (permalink / raw)
To: Abraham, Danny <danny_abraham@bmc.com>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
"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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-03-19 13:40 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-03-19 12:59 set local statement_timeout within a stored procedure Abraham, Danny <danny_abraham@bmc.com>
2024-03-19 13:40 ` Re: set local statement_timeout within a stored procedure Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox