Skip to content

pg_calendar

Working calendars with holidays, exceptions and date arithmetic.

pg_extensions · Working calendars with holidays, exceptions and date arithmetic.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102089pg_calendarpg_extensions0.3.0TIMEMatroid-SAL-1.0Rust

PostgreSQL · 14, 15, 16, 17

Usage

Sources:

pg_calendar 0.3.0 manages named working calendars, weekly patterns, holidays and explicit date exceptions in the pgcalendar schema.

Core Workflow

CREATE EXTENSION pg_calendar;
SELECT pgcalendar.seed_iso();
SELECT pgcalendar.is_working_day('iso', DATE '2026-10-02');
SELECT pgcalendar.add_working_days('iso', DATE '2026-10-02', 3);

Operational Boundaries

The control does not require superuser-only installation, but object-creation privileges still apply. No preload is required. create_calendar, set_working_days, add_holiday and add_exception define calendars; is_working_day, add_working_days and interval-counting functions query them. Exceptions override holidays and weekly patterns. Seed functions create working-week conventions, not authoritative worldwide holiday data. The pg_calendar.enabled setting is superuser controlled. This is an unsupported proof of concept under Matroid Source Available License 1.0. APIs may change. Version 0.3.0 is the new upgrade baseline: earlier 0.2.0 installations require a rehearsed data migration/recreation, not ordinary ALTER EXTENSION UPDATE. Back up data and dependencies before following that destructive upstream path.

Table reader