Re: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tatsuo Ishii <ishii@sraoss.co.jp>
Cc: rmohite@xento.com, pgsql-bugs@lists.postgresql.org, andres@anarazel.de
Date: 2019-10-24T18:19:29Z
Lists: pgsql-bugs

Attachments

I wrote:
> Tatsuo Ishii <ishii@sraoss.co.jp> writes:
>> With attached patch (against master), SET STATEMENT_TIMEOUT
>> immediately affects to subsequent commands in the multi statement. I
>> think this is not only more intuitive than v10's behavior but it meets
>> the original reporter's expectation.

> Hm.  So, okay, that is a nicer API probably, but note that it also
> has the effect that the timeout starts over again for each statement
> in the string, while before it applied to the string as a whole.
> Are we okay with that change?  (I've not yet looked to see if it's
> documented anywhere that it works that way...)  It's kind of tossing
> some of the optimization intended by f8e5f156b overboard, since when
> a timeout is active we'll be doing timeout calculations for each
> statement in the string.

I looked around, and as far as I can tell, there is no detail at all
about this in our user-facing docs.  I think we should apply a doc
patch more or less like the attached.  This fails to provide a complete
spec of what the behavior used to be, but I don't much care to try to
document that 100% exactly.

Anyone have an objection to pushing ahead with this for HEAD only?

			regards, tom lane

Commits

  1. Improve management of statement timeouts.

  2. Reset statement_timeout between queries of a multi-query string.

  3. Rearm statement_timeout after each executed query.