diff --git a/expected/http.out b/expected/http.out index a779748..9fe4109 100644 --- a/expected/http.out +++ b/expected/http.out @@ -236,3 +236,18 @@ SELECT status FROM http_get('http://localhost:9080/delay/7'); 200 (1 row) +-- Check that statement interruption works +SET statement_timeout = 200; +CREATE TEMPORARY TABLE timer AS + SELECT now() AS start; +SELECT * + FROM http_get('http://localhost:9080/delay/7'); +ERROR: canceling statement due to user request +SELECT round(extract(epoch FROM now() - start) * 10) AS m + FROM timer; + m +--- + 2 +(1 row) + +DROP TABLE timer; diff --git a/sql/http.sql b/sql/http.sql index 7274104..4a6fed7 100644 --- a/sql/http.sql +++ b/sql/http.sql @@ -147,3 +147,16 @@ SELECT status FROM http_get('http://localhost:9080/status/555'); -- the default (5s), but shorter than the new timeout SELECT http_set_curlopt('CURLOPT_TIMEOUT_MS', '10000'); SELECT status FROM http_get('http://localhost:9080/delay/7'); + +-- Check that statement interruption works +SET statement_timeout = 200; +CREATE TEMPORARY TABLE timer AS + SELECT now() AS start; +SELECT * + FROM http_get('http://localhost:9080/delay/7'); +SELECT round(extract(epoch FROM now() - start) * 10) AS m + FROM timer; +DROP TABLE timer; + + +