Re: SET transaction_timeout inside a transaction

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Quentin de Metz <quentin@de.me.tz>
Cc: "pgsql-novice@postgresql.org" <pgsql-novice@postgresql.org>, "amborodin@acm.org" <amborodin@acm.org>, "aekorotkov@gmail.com" <aekorotkov@gmail.com>, "japinli@hotmail.com" <japinli@hotmail.com>, "zhjwpku@gmail.com" <zhjwpku@gmail.com>
Date: 2025-09-19T20:24:18Z
Lists: pgsql-novice
On Friday, September 19, 2025, Quentin de Metz <quentin@de.me.tz> wrote:
>
>
> 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);


It’s seems perfectly reasonable that as soon as a transaction begins it
sets up a timer using the then-current value of transaction_timeout.  And
that changing the variable doesn’t affect any already established timers.

David J.