 
 
 ------------------------------------------------------------------------------------------------------
--- Return another day's worth of events
+-- Return another day's worth of events: i.e. one day that matches the criteria, since we don't
+-- currently implement sub-day scheduling.
+--
+-- This is cheeky:  The incrementing by a day is done outside the call, so we either return the
+-- empty set (if the input date fails our filters) or we return a set containing the input date.
 ------------------------------------------------------------------------------------------------------
 CREATE or REPLACE FUNCTION daily_set( TIMESTAMP WITH TIME ZONE, rrule_parts ) RETURNS SETOF TIMESTAMP WITH TIME ZONE AS $$
 DECLARE

    -- We don't yet implement byweekno, byblah
    RETURN NEXT after;
  END IF;
END;
$$ LANGUAGE 'plpgsql' IMMUTABLE STRICT;



------------------------------------------------------------------------------------------------------
-- Return another week's worth of events
--
-- Doesn't handle truly obscure and unlikely stuff like BYWEEKNO=5;BYMONTH=1;BYDAY=WE,TH,FR;BYSETPOS=-2
-- Imagine that.
------------------------------------------------------------------------------------------------------
CREATE or REPLACE FUNCTION weekly_set( TIMESTAMP WITH TIME ZONE, rrule_parts ) RETURNS SETOF TIMESTAMP WITH TIME ZONE AS $$
DECLARE
