I have a recurrence table that stores the iCalendar RFC 5545 Recurrence Rule string. Ex:
FREQ=MONTHLY;INTERVAL=2
Does anyone know of any postgres functions similar to do the following?
get_events_between(date,date)
Where It would just query the recurrence table and parse the rrule string.
In PostgreSQL, the CTE(Common Table Expression) is used as a temporary result set that the user can reference within another SQL statement like SELECT, INSERT, UPDATE or DELETE. CTEs are temporary in the sense that they only exist during the execution of the query.
CONNECT BY, PRIOR and START WITH in Oracle In Oracle, the hierarchical query is defined using the two mandatory keywords i.e. CONNECT BY and START WITH. The hierarchy is built when the CONNECT BY defines the relationship between parent and child, the PRIOR keyword used with CONNECT by specifies the parent.
You can use data-modifying statements (INSERT, UPDATE or DELETE) in WITH. This allows you to perform several different operations in the same query.
WITH provides a way to write auxiliary statements for use in a larger query. These statements, which are often referred to as Common Table Expressions or CTE s, can be thought of as defining temporary tables that exist just for one query.
In PostgreSQL, as of version 14, there is no built-in support for RFC-5545 Recurrence Rule format.
But there are some custom extensions out there.
pg_rrule. When you install it, you should be able to query Ical schedules this way:
SELECT * FROM unnest( get_occurrences( 'FREQ=MONTHLY;INTERVAL=2'::rrule, now(), now() + '6 months'::interval ) );
postgres-rrule
You can get a Python RRULE parser (like dateutil) and embed it postgres using PL/Python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With