PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16035
PG Version10.8
OSWindows 10
Opened2019-10-03 06:38:33+00
Reported byRaj Mohite
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16035
Logged by:          Raj Mohite
Email address:      (redacted)
PostgreSQL version: 10.8
Operating system:   Windows 10
Description:        

I have created a simple sql where I have added STATEMENT_TIMEOUT = 1 seconds
and added explicit delay(pg_sleep(5) ) of 5 seconds inside CTE. 

Below sql should get killed after 1 second but looks like it is running for
5 seconds.

SET STATEMENT_TIMEOUT = '1s';SELECT * FROM ( WITH test AS ( SELECT
pg_sleep(5), 'Billy' as emp_name ) SELECT 1 FROM test ) AS sub;

Note: If we remove the quoted string 'Billy' AS emp_name  from above sql
then proper timeout is getting applied. If we keep quoted string -- 'Billy'
AS emp_name in the comment then also it doesn't work.

Solution: We are still finding the root cause for the above behavior but I
found that if we will put the SET STATEMENT_TIMEOUT before and after the sql
then it working fine.

Example:
SET STATEMENT_TIMEOUT = '3s';SELECT * FROM ( WITH test AS ( SELECT
pg_sleep(5), 'Billy' as emp_name ) SELECT 1 FROM test ) AS sub;SET
STATEMENT_TIMEOUT = '1s';  

Above example will timeout after 3 seconds i.e. it will consider the 1st
timeout value.

Can you please help us to know why STATEMENT_TIMEOUT is not working in first
example?

Messages

DateAuthorSubject
2019-10-03 06:38:33+00PG Bug reporting formBUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
2019-10-03 14:51:46+00Tom LaneRe: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
2019-10-04 08:10:08+00Tatsuo IshiiRe: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
2019-10-06 07:22:20+00Tatsuo IshiiRe: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
2019-10-21 05:02:17+00Tatsuo IshiiRe: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
2019-10-21 05:03:54+00Tom LaneRe: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
2019-10-21 23:02:05+00Tom LaneRe: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql
2019-10-24 18:19:29+00Tom LaneRe: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql