exit if no need for a roll

This commit is contained in:
Paul Trowbridge 2018-09-25 13:57:02 -04:00
parent 5ce69011c4
commit a39df2aa1c

View File

@ -1,4 +1,5 @@
--CREATE FUNCTION evt.balrf() RETURNS void AS
CREATE FUNCTION evt.balrf() RETURNS void
LANGUAGE plpgsql AS
DO
$func$
DECLARE
@ -12,7 +13,7 @@ BEGIN
COALESCE(
MAX(lower(dur)) FILTER (WHERE prop @> '{"rf":"global"}'::jsonb)
,MIN(lower(dur)) FILTER (WHERE prop @> '{"gltouch":"yes"}'::jsonb)
) maxd
) mind
--max period touched
,MAX(lower(dur)) FILTER (WHERE prop @> '{"gltouch":"yes"}'::jsonb) maxd
INTO
@ -21,6 +22,11 @@ BEGIN
FROM
evt.fspr;
IF
_maxd <= _mind
RETURN;
END IF
WITH
--list each period in min and max
prng AS (