pg_rrule

RRULE field type for PostgreSQL

Overview

PackageVersionCategoryLicenseLanguage
pg_rrule0.3.0TYPEMITC
IDExtensionBinLibLoadCreateTrustRelocSchema
3880pg_rruleNoYesNoYesNoYes-
Relatedprefix semver unit pgpdf pglite_fusion md5hash asn1oid roaringbitmap

require libical

Version

TypeRepoVersionPG VerPackageDeps
EXTMIXED0.3.01817161514pg_rrule-
RPMPIGSTY0.3.01817161514pg_rrule_$vlibical
DEBPGDG0.3.01817161514postgresql-$v-pg-rrule-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
d12.aarch64
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
d13.x86_64
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
d13.aarch64
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
u22.x86_64
u22.aarch64
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
u24.x86_64
u24.aarch64
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0

Build

You can build the RPM packages for pg_rrule using pig build:

pig build pkg pg_rrule         # build RPM packages

Install

You can install pg_rrule directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install pg_rrule;          # Install for current active PG version
pig ext install -y pg_rrule -v 18  # PG 18
pig ext install -y pg_rrule -v 17  # PG 17
pig ext install -y pg_rrule -v 16  # PG 16
pig ext install -y pg_rrule -v 15  # PG 15
pig ext install -y pg_rrule -v 14  # PG 14
dnf install -y pg_rrule_18       # PG 18
dnf install -y pg_rrule_17       # PG 17
dnf install -y pg_rrule_16       # PG 16
dnf install -y pg_rrule_15       # PG 15
dnf install -y pg_rrule_14       # PG 14
apt install -y postgresql-18-pg-rrule   # PG 18
apt install -y postgresql-17-pg-rrule   # PG 17
apt install -y postgresql-16-pg-rrule   # PG 16
apt install -y postgresql-15-pg-rrule   # PG 15
apt install -y postgresql-14-pg-rrule   # PG 14

Create Extension:

CREATE EXTENSION pg_rrule;

Usage

pg_rrule: iCalendar RRULE recurrence rule type for PostgreSQL

The pg_rrule extension provides an RRULE data type for parsing and expanding iCalendar recurrence rules (RFC 5545).

CREATE EXTENSION pg_rrule;

Parameter Extraction

-- Get frequency
SELECT get_freq('FREQ=WEEKLY;INTERVAL=1;WKST=MO;UNTIL=20200101T045102Z'::rrule);
-- WEEKLY

-- Get days of week (numeric array)
SELECT get_byday('FREQ=WEEKLY;BYDAY=MO,TH,SU'::rrule);
-- {2,5,1}

Occurrence Generation

-- Generate occurrences from an RRULE
SELECT unnest(get_occurrences(
    'FREQ=DAILY;INTERVAL=1;UNTIL=20200105T000000Z'::rrule,
    '2020-01-01 00:00:00'::timestamp
));

The get_occurrences() function expands RRULE definitions into concrete timestamp sequences, supporting both timezone-aware and naive timestamp parameters.

Dependencies

Requires libical for iCalendar standard compliance.


Last Modified 2026-03-12: add pg extension catalog (95749bf)