From 865e72b328050bc8d1bf8bd2f982edb7a4eb4e26 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Thu, 23 Jan 2025 15:36:03 -0800 Subject: [PATCH] Add test for interrupt --- expected/http.out | 15 +++++++++++++++ sql/http.sql | 13 +++++++++++++ 2 files changed, 28 insertions(+) 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; + + +