Re: SET transaction_timeout inside a transaction - Mailing list pgsql-novice

From Bzzzz
Subject Re: SET transaction_timeout inside a transaction
Date
Msg-id 20250919222149.27ab94c8@msi
Whole thread Raw
In response to SET transaction_timeout inside a transaction  ("Quentin de Metz" <quentin@de.me.tz>)
List pgsql-novice
On Fri, 19 Sep 2025 22:12:59 +0200
"Quentin de Metz" <quentin@de.me.tz> wrote:

> Hello,

Hi,

> It appears that changing the transaction_timeout when inside a
> transaction does not work as expected.
>
> Running the following script on master:
>
> SET transaction_timeout = '1s';
> BEGIN;
> SET transaction_timeout = '3s';
> SELECT pg_sleep(2);
>
> Fails with the following:
>
> FATAL:  terminating connection due to transaction timeout
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
>
> A workaround is to "SET transaction_timeout = 0" before each
> override. But this resets the timer, which may not be aligned with
> this parameter's intention.

You'll see what others will say, but it looks pretty logical to me to
forbid an action on the one parameter your transaction directly depends
on when inside it.

Jean-Yves
--



pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: SET transaction_timeout inside a transaction
Next
From: "David G. Johnston"
Date:
Subject: Re: SET transaction_timeout inside a transaction