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

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us, rmohite(at)xento(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, andres(at)anarazel(dot)de
Subject: Re: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
Date: 2019-10-21 05:02:17
Message-ID: 20191021.140217.112252720388603202.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

If there's no objection, I would like to commit/push the diff.

> I admit v11's current behavior is inconstant, but I am not sue going
> to back V10's behavior is a good idea.
>
> 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.
>
> SET STATEMENT_TIMEOUT = '10s';
> SET
> Time: 0.418 ms
> -- SELECT timeout in 1 second.
> SET STATEMENT_TIMEOUT = '1s'\;SELECT * FROM ( WITH test AS ( SELECT pg_sleep(5), 'Billy' as emp_name ) SELECT 1 FROM test ) AS sub;
> ERROR: canceling statement due to statement timeout
> Time: 1001.107 ms (00:01.001)
>
> Here are results of test cases attached (statement_timeout.sql).
>
> \timing
> Timing is on.
> -- SELECT timeout in 1 second.
> SET STATEMENT_TIMEOUT = '1s'\;SELECT * FROM ( WITH test AS ( SELECT pg_sleep(5), 'Billy' as emp_name ) SELECT 1 FROM test ) AS sub;
> psql:/home/t-ishii/tmp/statement_timeout.sql:3: ERROR: canceling statement due to statement timeout
> Time: 1001.138 ms (00:01.001)
> SET STATEMENT_TIMEOUT = '10s';
> SET
> Time: 0.434 ms
> -- SELECT timeout in 1 second.
> SET STATEMENT_TIMEOUT = '1s'\;SELECT * FROM ( WITH test AS ( SELECT pg_sleep(5), 'Billy' as emp_name ) SELECT 1 FROM test ) AS sub;
> psql:/home/t-ishii/tmp/statement_timeout.sql:7: ERROR: canceling statement due to statement timeout
> Time: 1000.978 ms (00:01.001)
> -- This time SELECT succeeds and STATEMENT_TIMEOUT is set to 8 secinds.
> SET STATEMENT_TIMEOUT = '8s'\;SELECT * FROM ( WITH test AS ( SELECT pg_sleep(5), 'Billy' as emp_name ) SELECT 1 FROM test ) AS sub;
> ?column?
> ----------
> 1
> (1 row)
>
> Time: 5004.886 ms (00:05.005)
> SHOW STATEMENT_TIMEOUT;
> statement_timeout
> -------------------
> 8s
> (1 row)
>
> Time: 0.433 ms
> -- Following SELECT succeeds because now statement_timeout value is 8 seconds..
> SELECT * FROM ( WITH test AS ( SELECT pg_sleep(5), 'Billy' as emp_name ) SELECT 1 FROM test ) AS sub;
> ?column?
> ----------
> 1
> (1 row)
>
> Time: 5006.196 ms (00:05.006)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-10-21 05:03:54 Re: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
Previous Message Tom Lane 2019-10-21 03:44:25 Re: BUG #16070: A double-free bug in interfaces/libpq/fe-secure-openssl.c