2024-07-22 12:49:57 +02:00
|
|
|
SELECT version() ~ 'cygwin' AS skip_test \gset
|
|
|
|
\if :skip_test
|
|
|
|
\quit
|
|
|
|
\endif
|
2024-08-30 16:47:39 -04:00
|
|
|
-- Let's test canceling a remote query. Use a table that does not have
|
|
|
|
-- remote_estimate enabled, else there will be multiple queries to the
|
|
|
|
-- remote and we might unluckily send the cancel in between two of them.
|
|
|
|
-- First let's confirm that the query is actually pushed down.
|
|
|
|
EXPLAIN (VERBOSE, COSTS OFF)
|
|
|
|
SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;
|
2024-07-22 12:49:57 +02:00
|
|
|
QUERY PLAN
|
|
|
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
Foreign Scan
|
|
|
|
Output: (count(*))
|
2024-08-30 16:47:39 -04:00
|
|
|
Relations: Aggregate on ((((public.ft1 a) INNER JOIN (public.ft1 b)) INNER JOIN (public.ft1 c)) INNER JOIN (public.ft1 d))
|
|
|
|
Remote SQL: SELECT count(*) FROM ((("S 1"."T 1" r1 INNER JOIN "S 1"."T 1" r2 ON (TRUE)) INNER JOIN "S 1"."T 1" r4 ON (TRUE)) INNER JOIN "S 1"."T 1" r6 ON (TRUE))
|
2024-07-22 12:49:57 +02:00
|
|
|
(4 rows)
|
|
|
|
|
|
|
|
BEGIN;
|
2024-08-30 16:47:39 -04:00
|
|
|
-- Make sure that connection is open and set up.
|
|
|
|
SELECT count(*) FROM ft1 a;
|
|
|
|
count
|
|
|
|
-------
|
|
|
|
822
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- Timeout needs to be long enough to be sure that we've sent the slow query.
|
|
|
|
SET LOCAL statement_timeout = '100ms';
|
|
|
|
-- This would take very long if not canceled:
|
|
|
|
SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;
|
2024-07-22 12:49:57 +02:00
|
|
|
ERROR: canceling statement due to statement timeout
|
|
|
|
COMMIT;
|