mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-23 16:42:35 +00:00
02bf8eeb9e
In one of the reported Debbie cases it took ~210ms to interrupt... git-svn-id: http://svn.osgeo.org/postgis/trunk@13232 b70326c6-7e19-0410-871a-916f4a2858ee
34 lines
866 B
PL/PgSQL
34 lines
866 B
PL/PgSQL
-- liblwgeom interruption
|
|
|
|
CREATE TEMPORARY TABLE _time AS SELECT now() t;
|
|
|
|
CREATE FUNCTION _timecheck(label text, tolerated interval) RETURNS text
|
|
AS $$
|
|
DECLARE
|
|
ret TEXT;
|
|
lap INTERVAL;
|
|
BEGIN
|
|
lap := now()-t FROM _time;
|
|
IF lap <= tolerated THEN ret := label || ' interrupted on time';
|
|
ELSE ret := label || ' interrupted late: ' || lap;
|
|
END IF;
|
|
UPDATE _time SET t = now();
|
|
RETURN ret;
|
|
END;
|
|
$$ LANGUAGE 'plpgsql' VOLATILE;
|
|
|
|
-----------------
|
|
-- ST_Segmentize
|
|
-----------------
|
|
|
|
SET statement_timeout TO 100;
|
|
-- would run for many seconds if uninterruptible...
|
|
SELECT ST_Segmentize(ST_MakeLine(ST_Point(4,39), ST_Point(1,41)), 1e-100);
|
|
SELECT _timecheck('segmentize', '250ms');
|
|
SET statement_timeout TO 0;
|
|
-- Not affected by old timeout
|
|
SELECT '1',ST_AsText(ST_Segmentize('LINESTRING(0 0,4 0)'::geometry, 2));
|
|
|
|
|
|
DROP FUNCTION _timecheck(text, interval);
|