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 DO
$func$ $func$
DECLARE DECLARE
@ -12,7 +13,7 @@ BEGIN
COALESCE( COALESCE(
MAX(lower(dur)) FILTER (WHERE prop @> '{"rf":"global"}'::jsonb) MAX(lower(dur)) FILTER (WHERE prop @> '{"rf":"global"}'::jsonb)
,MIN(lower(dur)) FILTER (WHERE prop @> '{"gltouch":"yes"}'::jsonb) ,MIN(lower(dur)) FILTER (WHERE prop @> '{"gltouch":"yes"}'::jsonb)
) maxd ) mind
--max period touched --max period touched
,MAX(lower(dur)) FILTER (WHERE prop @> '{"gltouch":"yes"}'::jsonb) maxd ,MAX(lower(dur)) FILTER (WHERE prop @> '{"gltouch":"yes"}'::jsonb) maxd
INTO INTO
@ -20,6 +21,11 @@ BEGIN
,_maxd ,_maxd
FROM FROM
evt.fspr; evt.fspr;
IF
_maxd <= _mind
RETURN;
END IF
WITH WITH
--list each period in min and max --list each period in min and max