Skip to content

Commit 865e72b

Browse files
committed
Add test for interrupt
1 parent c4fa7dd commit 865e72b

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

expected/http.out

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,18 @@ SELECT status FROM http_get('http://localhost:9080/delay/7');
236236
200
237237
(1 row)
238238

239+
-- Check that statement interruption works
240+
SET statement_timeout = 200;
241+
CREATE TEMPORARY TABLE timer AS
242+
SELECT now() AS start;
243+
SELECT *
244+
FROM http_get('http://localhost:9080/delay/7');
245+
ERROR: canceling statement due to user request
246+
SELECT round(extract(epoch FROM now() - start) * 10) AS m
247+
FROM timer;
248+
m
249+
---
250+
2
251+
(1 row)
252+
253+
DROP TABLE timer;

sql/http.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,16 @@ SELECT status FROM http_get('http://localhost:9080/status/555');
147147
-- the default (5s), but shorter than the new timeout
148148
SELECT http_set_curlopt('CURLOPT_TIMEOUT_MS', '10000');
149149
SELECT status FROM http_get('http://localhost:9080/delay/7');
150+
151+
-- Check that statement interruption works
152+
SET statement_timeout = 200;
153+
CREATE TEMPORARY TABLE timer AS
154+
SELECT now() AS start;
155+
SELECT *
156+
FROM http_get('http://localhost:9080/delay/7');
157+
SELECT round(extract(epoch FROM now() - start) * 10) AS m
158+
FROM timer;
159+
DROP TABLE timer;
160+
161+
162+

0 commit comments

Comments
 (0)