agora inbox for pgsql-admin@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Teja Jakkidi <teja.jakkidi05@gmail.com>
Cc: pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Statement_timeout in procedure block
Date: Wed, 19 Jun 2024 10:58:33 -0400
Message-ID: <114105.1718809113@sss.pgh.pa.us> (raw)
In-Reply-To: <46a33904c2cd86718cb4d7a0291906a08b8e246a.camel@cybertec.at>
References: <E0175C30-9A8F-4648-A2D5-36908FF6F695@gmail.com>
	<46a33904c2cd86718cb4d7a0291906a08b8e246a.camel@cybertec.at>

Laurenz Albe <laurenz.albe@cybertec.at> writes:
> What works is setting the parameter on the procedure:

> test=> CREATE OR REPLACE PROCEDURE sit() LANGUAGE plpgsql SET statement_timeout = 2000 AS 'BEGIN PERFORM pg_sleep(5); END;';
> CREATE PROCEDURE

That doesn't work either, for me, and I would not expect any of these
variants to do so.  The reason is that statement_timeout is defined
to limit the runtime of a "statement" defined as a single command
received from the client --- in this case, the CALL statement --- and
the timer starts running (or doesn't) at the time of command receipt.
So it's the previously-prevailing value of statement_timeout that
determines what happens, and no amount of thrashing within the command
will change the already-established overall timeout for it.

If you're desperate, transaction_timeout might serve for this, since
it looks like changes in that affect the timer immediately.  But
it has the effect of killing the session altogether, which is
probably a bigger hammer than you want.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <114105.1718809113@sss.pgh.pa.us>
Permalink:  ../114105.1718809113@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/114105.1718809113@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, laurenz.albe@cybertec.at, teja.jakkidi05@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Statement_timeout in procedure block
  In-Reply-To: <114105.1718809113@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox