pg_rrule

pg_rrule

pg_rrule : RRULE field type for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
3880
pg_rrule
pg_rrule
0.3.0
TYPE
MIT
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
prefix
semver
unit
pgpdf
pglite_fusion
md5hash
asn1oid
roaringbitmap

require libical

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
MIXED
0.3.0
18
17
16
15
14
pg_rrule-
RPM
PIGSTY
0.3.0
18
17
16
15
14
pg_rrule_$vlibical
DEB
PGDG
0.3.0
18
17
16
15
14
postgresql-$v-pg-rrule-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
el8.aarch64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
el9.x86_64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
el9.aarch64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
el10.x86_64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
el10.aarch64
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
PIGSTY 0.3.0
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
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
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
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
u24.aarch64
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0
PGDG 0.3.0

Source

pig build pkg pg_rrule;		# build rpm

Install

Make sure PGDG and PIGSTY repo available:

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

Install this extension with pig:

pig install pg_rrule;		# install via package name, for the active PG version

pig install pg_rrule -v 18;   # install for PG 18
pig install pg_rrule -v 17;   # install for PG 17
pig install pg_rrule -v 16;   # install for PG 16
pig install pg_rrule -v 15;   # install for PG 15
pig install pg_rrule -v 14;   # install for PG 14

Create this extension with:

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 updated on