Re: Statement_timeout in procedure block - Mailing list pgsql-admin

From Tom Lane
Subject Re: Statement_timeout in procedure block
Date
Msg-id 114105.1718809113@sss.pgh.pa.us
Whole thread Raw
In response to Re: Statement_timeout in procedure block  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Statement_timeout in procedure block
List pgsql-admin
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



pgsql-admin by date:

Previous
From: Michael Banck
Date:
Subject: Re: Urgent: Segmentation Fault in PostgreSQL postmaster Process
Next
From: Laurenz Albe
Date:
Subject: Re: Statement_timeout in procedure block