Skip to content

Commit ecf741c

Browse files
committed
Stabilize postgres_fdw test
The test fails when RESET statement_timeout takes longer than 10ms. Avoid the problem by using SET LOCAL instead. Overall, this test is not ideal: 10ms could be shorter than the time to have sent the query to the "remote" server, so it's possible that on some machines this test doesn't actually witness a remote query being cancelled. We may want to improve on this someday by using some other testing technique, but for now it's better than nothing. I verified manually that one round of remote cancellation occurs when this runs on my machine. Discussion: https://postgr.es/m/CAGECzQRsdWnj=YaaPCnA8d7E1AdbxRPBYmyBQRMPUijR2MpM_w@mail.gmail.com
1 parent 056c565 commit ecf741c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,10 +2750,11 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 CROSS JOIN ft2 CROSS JOIN
27502750
(4 rows)
27512751

27522752
-- Make sure query cancellation works
2753-
SET statement_timeout = '10ms';
2753+
BEGIN;
2754+
SET LOCAL statement_timeout = '10ms';
27542755
select count(*) from ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5; -- this takes very long
27552756
ERROR: canceling statement due to statement timeout
2756-
RESET statement_timeout;
2757+
COMMIT;
27572758
-- ====================================================================
27582759
-- Check that userid to use when querying the remote table is correctly
27592760
-- propagated into foreign rels present in subqueries under an UNION ALL

contrib/postgres_fdw/sql/postgres_fdw.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,10 @@ ALTER VIEW v4 OWNER TO regress_view_owner;
740740
-- Make sure this big CROSS JOIN query is pushed down
741741
EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5;
742742
-- Make sure query cancellation works
743-
SET statement_timeout = '10ms';
743+
BEGIN;
744+
SET LOCAL statement_timeout = '10ms';
744745
select count(*) from ft1 CROSS JOIN ft2 CROSS JOIN ft4 CROSS JOIN ft5; -- this takes very long
745-
RESET statement_timeout;
746+
COMMIT;
746747

747748
-- ====================================================================
748749
-- Check that userid to use when querying the remote table is correctly

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy