Re: Statement timeout behavior in extended queries

Tatsuo Ishii <ishii@sraoss.co.jp>

From: Tatsuo Ishii <ishii@sraoss.co.jp>
To: tsunakawa.takay@jp.fujitsu.com
Cc: andres@anarazel.de, david@fetter.org, pgsql-hackers@postgresql.org
Date: 2017-04-05T07:18:07Z
Lists: pgsql-hackers
> Then, the following sequence should have occurred.  The test result is valid.

Yes, I remembered that and was about to make a posting :-)

> # Execute statement which takes 2 seconds.
> 'P'	"S1"	"SELECT pg_sleep(2)"	0
>   -> start transaction T1
> 'B'	"S2"	"S1"	0	0	0

Yes, an extended query automatically starts a transaction if there's
no ongoing transaction.

> 'P'	""	"SET statement_timeout = '1s'"	0
> 'B'	""	""	0	0	0
> 'E'	""	0
> 
> # Execute statement which takes 2 seconds (statement timeout expected).
> 'E'	"S2"	0
>   -> timeout error occurred, T1 aborted

Right. The automatically started transaction is aborted and the effect
of the set statement is canceled.

In summary, as far as I know Andres's patch is working as expected.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp


Commits

  1. Rearm statement_timeout after each executed query.