diff --git a/postgres-rrule.sql b/postgres-rrule.sql index 9b457d2..54c78d0 100644 --- a/postgres-rrule.sql +++ b/postgres-rrule.sql @@ -429,14 +429,16 @@ CREATE OR REPLACE FUNCTION _rrule.rruleset (TEXT) RETURNS _rrule.RRULESET AS $$ WITH "dtstart-line" AS (SELECT _rrule.parse_line($1::text, 'DTSTART') as "x"), "dtend-line" AS (SELECT _rrule.parse_line($1::text, 'DTEND') as "x"), - "exrule-line" AS (SELECT _rrule.parse_line($1::text, 'EXRULE') as "x") + "exrule-line" AS (SELECT _rrule.parse_line($1::text, 'EXRULE') as "x"), + "rdate-line" AS (SELECT _rrule.parse_line($1::text, 'RDATE') as "x"), + "exdate-line" AS (SELECT _rrule.parse_line($1::text, 'EXDATE') as "x") SELECT (SELECT "x"::timestamp FROM "dtstart-line" LIMIT 1) AS "dtstart", (SELECT "x"::timestamp FROM "dtend-line" LIMIT 1) AS "dtend", (SELECT _rrule.rrule($1::text) "rrule") as "rrule", (SELECT _rrule.rrule("x"::text) "rrule" FROM "exrule-line") as "exrule", - NULL::TIMESTAMP[] "rdate", - NULL::TIMESTAMP[] "exdate"; + (SELECT (regexp_split_to_array("x"::text, ','))::TIMESTAMP[] from "rdate-line" AS "rdate"), + (SELECT (regexp_split_to_array("x"::text, ','))::TIMESTAMP[] from "exdate-line" AS "exdate"); $$ LANGUAGE SQL IMMUTABLE STRICT; -- All of the function(rrule, ...) forms also accept a text argument, which will @@ -983,4 +985,3 @@ CREATE CAST (jsonb AS _rrule.RRULE) CREATE CAST (_rrule.RRULE AS jsonb) WITH FUNCTION _rrule.rrule_to_jsonb(_rrule.RRULE) AS IMPLICIT; - diff --git a/src/functions/0105-rruleset.sql b/src/functions/0105-rruleset.sql index 7446e68..f54d49a 100644 --- a/src/functions/0105-rruleset.sql +++ b/src/functions/0105-rruleset.sql @@ -2,13 +2,14 @@ CREATE OR REPLACE FUNCTION _rrule.rruleset (TEXT) RETURNS _rrule.RRULESET AS $$ WITH "dtstart-line" AS (SELECT _rrule.parse_line($1::text, 'DTSTART') as "x"), "dtend-line" AS (SELECT _rrule.parse_line($1::text, 'DTEND') as "x"), - "exrule-line" AS (SELECT _rrule.parse_line($1::text, 'EXRULE') as "x") + "exrule-line" AS (SELECT _rrule.parse_line($1::text, 'EXRULE') as "x"), + "rdate-line" AS (SELECT _rrule.parse_line($1::text, 'RDATE') as "x"), + "exdate-line" AS (SELECT _rrule.parse_line($1::text, 'EXDATE') as "x") SELECT (SELECT "x"::timestamp FROM "dtstart-line" LIMIT 1) AS "dtstart", (SELECT "x"::timestamp FROM "dtend-line" LIMIT 1) AS "dtend", (SELECT _rrule.rrule($1::text) "rrule") as "rrule", (SELECT _rrule.rrule("x"::text) "rrule" FROM "exrule-line") as "exrule", - NULL::TIMESTAMP[] "rdate", - NULL::TIMESTAMP[] "exdate"; + (SELECT (regexp_split_to_array("x"::text, ','))::TIMESTAMP[] from "rdate-line" AS "rdate"), + (SELECT (regexp_split_to_array("x"::text, ','))::TIMESTAMP[] from "exdate-line" AS "exdate"); $$ LANGUAGE SQL IMMUTABLE STRICT; -