Subject: Set timeout just on a query?

From: Shaozhong SHI <[email-masked]>
Date: Tue, 10 May 2022 01:58:26 +0100

Can timeout be set just on a query?

Can we do the following?

Begin

do a query
set timeout
Exception
report a record

End;

Regards,
David

---

From: Shaozhong SHI <[email-masked]>
Date: Tue, 10 May 2022 01:59:05 +0100

Can we do the following?

Begin

do a query
set timeout
Exception
report a record

End;

Regards,
David

---

From: Christophe Pettus <[email-masked]>
Date: Mon, 9 May 2022 18:00:08 -0700

> On May 9, 2022, at 17:58, Shaozhong SHI <[email-masked]> wrote:
> Begin
> 
> do a query
> set timeout 
> Exception
> report a record
> 
> End;

Yes.  The syntax you are looking for is:

	SET LOCAL statement_timeout = '<value>';

Best,
-- Christophe

---

From: Bharath Rupireddy <[email-masked]>
Date: Tue, 10 May 2022 09:26:47 +0530

> Can timeout be set just on a query?

Won't the statement_timeout [1] help here?

[1] https://www.postgresql.org/docs/devel/runtime-config-client.html

Regards,
Bharath Rupireddy.