Thread: pgchronos 1.0 released

pgchronos 1.0 released

From
Eric Worden
Date:
PGCHRONOS 1.0 RELEASED
======================

pgchronos is a new Postgresql extension providing sql functions and operators for performing union, intersection, and difference operations on sets of daterange and tstzrange types.

As a simple example of a difference operation, imagine a hotel where frequent customers can earn special member rates during most of the year, excluding holiday weeks.

    Select unnest(
        (select array_agg(range) from special_membership_ranges) -
        (select array_agg(range) from holiday_exclusion_ranges)) special_booking_ranges;

    special_booking_ranges
    -------------------------
    [2015-01-02,2015-01-06)
    [2015-01-07,2015-01-21)
    [2015-01-22,2015-01-29)

More typical usage scenarios will be more complex, something like subtracting student sick date ranges from the same students' course enrollment date ranges to find exact student attendance date ranges for some set of students.

These functions were originally developed as part of the ChronosDB project.  That code became half-obsolete when Postgres introduced range data types in version 9.2. This code is a reimplementation that brings it current with the latest Postgres versions, and utilizes the native Postgres range data types.  The current project site is <https://github.com/worden341/pgchronos>.


REQUIREMENTS
============

pgchronos utilizes the range datatypes introduced in Postgresql 9.2, therefore that is the minimum version you can use with this extension.


LINKS
=====


Eric Worden