Skip to content

Commit

Permalink
Add test for interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Jan 23, 2025
1 parent c4fa7dd commit 865e72b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
15 changes: 15 additions & 0 deletions expected/http.out
Original file line number Diff line number Diff line change
Expand Up @@ -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;
13 changes: 13 additions & 0 deletions sql/http.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;



0 comments on commit 865e72b

Please # to comment.