From 10242f51ee603863979c3dc4e5bfee27b05aa90b Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 13 Apr 2009 21:00:09 +1200 Subject: [PATCH] When we exceed count we should return null. --- dba/caldav_functions.sql | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dba/caldav_functions.sql b/dba/caldav_functions.sql index fbd96ad8..a684d81d 100644 --- a/dba/caldav_functions.sql +++ b/dba/caldav_functions.sql @@ -144,6 +144,8 @@ BEGIN IF ( count <= past_repeats ) THEN RETURN NULL; END IF; + ELSE + count := NULL; END IF; temp_txt := substring(repeatrule from ''BYSETPOS=([0-9-]+)(;|$)''); @@ -217,8 +219,11 @@ BEGIN EXIT WHEN our_answer >= earliest; -- Give up if we have exceeded the count - EXIT WHEN past_repeats > count; - past_repeats := past_repeats + 1; + IF ( count IS NOT NULL AND past_repeats > count ) THEN + RETURN NULL; + ELSE + past_repeats := past_repeats + 1; + END IF; loopcount := loopcount - 1; IF loopcount < 0 THEN