1 SELECT version() ~ 'cygwin' AS skip_test \gset
5 -- Let's test canceling a remote query. Use a table that does not have
6 -- remote_estimate enabled, else there will be multiple queries to the
7 -- remote and we might unluckily send the cancel in between two of them.
8 -- First let's confirm that the query is actually pushed down.
9 EXPLAIN (VERBOSE, COSTS OFF)
10 SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;
12 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
15 Relations: Aggregate on ((((public.ft1 a) INNER JOIN (public.ft1 b)) INNER JOIN (public.ft1 c)) INNER JOIN (public.ft1 d))
16 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))
20 -- Make sure that connection is open and set up.
21 SELECT count(*) FROM ft1 a;
27 -- On most machines, 10ms will be enough to be sure that we've sent the slow
28 -- query. We may sometimes exercise the race condition where we send cancel
29 -- before the remote side starts the query, but that's fine too.
30 SET LOCAL statement_timeout = '10ms';
31 -- This would take very long if not canceled:
32 SELECT count(*) FROM ft1 a CROSS JOIN ft1 b CROSS JOIN ft1 c CROSS JOIN ft1 d;
33 ERROR: canceling statement due to statement timeout