cron_utils
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
cron_utils | 0.1.0 | TIME | MIT | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 1140 | cron_utils | No | No | No | Yes | No | Yes | - |
| Related | pg_cron pgcalendar pg_rrule pg_when pgagent pg_task pg_dbms_job pg_duration pg_bikram_sambat pg_dispatch |
|---|
The PGXN 0.1.0 distribution is marked unstable; the control file marks the extension relocatable.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.1.0 | 1817161514 | cron_utils | - |
| RPM | PIGSTY | 0.1.0 | 1817161514 | cron_utils_$v | - |
| DEB | PIGSTY | 0.1.0 | 1817161514 | postgresql-$v-cron-utils | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.1.0 el8.x86_64.pg18 : cron_utils_18 cron_utils_18-0.1.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 0.1.0 el8.x86_64.pg17 : cron_utils_17 cron_utils_17-0.1.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 0.1.0 el8.x86_64.pg16 : cron_utils_16 cron_utils_16-0.1.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 0.1.0 el8.x86_64.pg15 : cron_utils_15 cron_utils_15-0.1.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 0.1.0 el8.x86_64.pg14 : cron_utils_14 cron_utils_14-0.1.0-1PIGSTY.el8.noarch.rpm
|
| el8.aarch64 | PIGSTY 0.1.0 el8.aarch64.pg18 : cron_utils_18 cron_utils_18-0.1.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 0.1.0 el8.aarch64.pg17 : cron_utils_17 cron_utils_17-0.1.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 0.1.0 el8.aarch64.pg16 : cron_utils_16 cron_utils_16-0.1.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 0.1.0 el8.aarch64.pg15 : cron_utils_15 cron_utils_15-0.1.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 0.1.0 el8.aarch64.pg14 : cron_utils_14 cron_utils_14-0.1.0-1PIGSTY.el8.noarch.rpm
|
| el9.x86_64 | PIGSTY 0.1.0 el9.x86_64.pg18 : cron_utils_18 cron_utils_18-0.1.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 0.1.0 el9.x86_64.pg17 : cron_utils_17 cron_utils_17-0.1.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 0.1.0 el9.x86_64.pg16 : cron_utils_16 cron_utils_16-0.1.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 0.1.0 el9.x86_64.pg15 : cron_utils_15 cron_utils_15-0.1.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 0.1.0 el9.x86_64.pg14 : cron_utils_14 cron_utils_14-0.1.0-1PIGSTY.el9.noarch.rpm
|
| el9.aarch64 | PIGSTY 0.1.0 el9.aarch64.pg18 : cron_utils_18 cron_utils_18-0.1.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 0.1.0 el9.aarch64.pg17 : cron_utils_17 cron_utils_17-0.1.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 0.1.0 el9.aarch64.pg16 : cron_utils_16 cron_utils_16-0.1.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 0.1.0 el9.aarch64.pg15 : cron_utils_15 cron_utils_15-0.1.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 0.1.0 el9.aarch64.pg14 : cron_utils_14 cron_utils_14-0.1.0-1PIGSTY.el9.noarch.rpm
|
| el10.x86_64 | PIGSTY 0.1.0 el10.x86_64.pg18 : cron_utils_18 cron_utils_18-0.1.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 0.1.0 el10.x86_64.pg17 : cron_utils_17 cron_utils_17-0.1.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 0.1.0 el10.x86_64.pg16 : cron_utils_16 cron_utils_16-0.1.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 0.1.0 el10.x86_64.pg15 : cron_utils_15 cron_utils_15-0.1.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 0.1.0 el10.x86_64.pg14 : cron_utils_14 cron_utils_14-0.1.0-1PIGSTY.el10.noarch.rpm
|
| el10.aarch64 | PIGSTY 0.1.0 el10.aarch64.pg18 : cron_utils_18 cron_utils_18-0.1.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 0.1.0 el10.aarch64.pg17 : cron_utils_17 cron_utils_17-0.1.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 0.1.0 el10.aarch64.pg16 : cron_utils_16 cron_utils_16-0.1.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 0.1.0 el10.aarch64.pg15 : cron_utils_15 cron_utils_15-0.1.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 0.1.0 el10.aarch64.pg14 : cron_utils_14 cron_utils_14-0.1.0-1PIGSTY.el10.noarch.rpm
|
| d12.x86_64 | PIGSTY 0.1.0 d12.x86_64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
| PIGSTY 0.1.0 d12.x86_64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
| PIGSTY 0.1.0 d12.x86_64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
| PIGSTY 0.1.0 d12.x86_64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
| PIGSTY 0.1.0 d12.x86_64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
|
| d12.aarch64 | PIGSTY 0.1.0 d12.aarch64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
| PIGSTY 0.1.0 d12.aarch64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
| PIGSTY 0.1.0 d12.aarch64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
| PIGSTY 0.1.0 d12.aarch64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
| PIGSTY 0.1.0 d12.aarch64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~bookworm_all.deb
|
| d13.x86_64 | PIGSTY 0.1.0 d13.x86_64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
| PIGSTY 0.1.0 d13.x86_64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
| PIGSTY 0.1.0 d13.x86_64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
| PIGSTY 0.1.0 d13.x86_64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
| PIGSTY 0.1.0 d13.x86_64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
|
| d13.aarch64 | PIGSTY 0.1.0 d13.aarch64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
| PIGSTY 0.1.0 d13.aarch64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
| PIGSTY 0.1.0 d13.aarch64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
| PIGSTY 0.1.0 d13.aarch64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
| PIGSTY 0.1.0 d13.aarch64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~trixie_all.deb
|
| u22.x86_64 | PIGSTY 0.1.0 u22.x86_64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
| PIGSTY 0.1.0 u22.x86_64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
| PIGSTY 0.1.0 u22.x86_64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
| PIGSTY 0.1.0 u22.x86_64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
| PIGSTY 0.1.0 u22.x86_64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
|
| u22.aarch64 | PIGSTY 0.1.0 u22.aarch64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
| PIGSTY 0.1.0 u22.aarch64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
| PIGSTY 0.1.0 u22.aarch64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
| PIGSTY 0.1.0 u22.aarch64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
| PIGSTY 0.1.0 u22.aarch64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~jammy_all.deb
|
| u24.x86_64 | PIGSTY 0.1.0 u24.x86_64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~noble_all.deb
| PIGSTY 0.1.0 u24.x86_64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~noble_all.deb
| PIGSTY 0.1.0 u24.x86_64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~noble_all.deb
| PIGSTY 0.1.0 u24.x86_64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~noble_all.deb
| PIGSTY 0.1.0 u24.x86_64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~noble_all.deb
|
| u24.aarch64 | PIGSTY 0.1.0 u24.aarch64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~noble_all.deb
| PIGSTY 0.1.0 u24.aarch64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~noble_all.deb
| PIGSTY 0.1.0 u24.aarch64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~noble_all.deb
| PIGSTY 0.1.0 u24.aarch64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~noble_all.deb
| PIGSTY 0.1.0 u24.aarch64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~noble_all.deb
|
| u26.x86_64 | PIGSTY 0.1.0 u26.x86_64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
| PIGSTY 0.1.0 u26.x86_64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
| PIGSTY 0.1.0 u26.x86_64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
| PIGSTY 0.1.0 u26.x86_64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
| PIGSTY 0.1.0 u26.x86_64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
|
| u26.aarch64 | PIGSTY 0.1.0 u26.aarch64.pg18 : postgresql-18-cron-utils postgresql-18-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
| PIGSTY 0.1.0 u26.aarch64.pg17 : postgresql-17-cron-utils postgresql-17-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
| PIGSTY 0.1.0 u26.aarch64.pg16 : postgresql-16-cron-utils postgresql-16-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
| PIGSTY 0.1.0 u26.aarch64.pg15 : postgresql-15-cron-utils postgresql-15-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
| PIGSTY 0.1.0 u26.aarch64.pg14 : postgresql-14-cron-utils postgresql-14-cron-utils_0.1.0-1PIGSTY~resolute_all.deb
|
Build
You can build the RPM / DEB packages for cron_utils using pig build:
pig build pkg cron_utils # build RPM / DEB packages
Install
You can install cron_utils 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 cron_utils; # Install for current active PG version
pig ext install -y cron_utils -v 18 # PG 18
pig ext install -y cron_utils -v 17 # PG 17
pig ext install -y cron_utils -v 16 # PG 16
pig ext install -y cron_utils -v 15 # PG 15
pig ext install -y cron_utils -v 14 # PG 14
dnf install -y cron_utils_18 # PG 18
dnf install -y cron_utils_17 # PG 17
dnf install -y cron_utils_16 # PG 16
dnf install -y cron_utils_15 # PG 15
dnf install -y cron_utils_14 # PG 14
apt install -y postgresql-18-cron-utils # PG 18
apt install -y postgresql-17-cron-utils # PG 17
apt install -y postgresql-16-cron-utils # PG 16
apt install -y postgresql-15-cron-utils # PG 15
apt install -y postgresql-14-cron-utils # PG 14
Create Extension:
CREATE EXTENSION cron_utils;
Usage
Sources:
cron_utils parses five-field cron expressions and calculates trigger timestamps inside PostgreSQL. It is a scheduling utility, not a job runner: use it to preview, validate, or query a schedule, and use a scheduler such as pg_cron separately to execute work.
Core Workflow
CREATE EXTENSION cron_utils;
-- First trigger at or after the supplied time.
SELECT cron_first_trigger('0 9 * * 1-5', now());
-- Last trigger before the supplied time (strict is true by default).
SELECT cron_last_trigger('0 9 * * 1-5', now());
-- Next five hourly triggers.
SELECT *
FROM cron_iterate_n('0 * * * *', now(), false, 'next', 5);
To inspect a bounded window:
SELECT *
FROM cron_first_last_triggers(
'0 0 * * *',
date_trunc('month', now()),
date_trunc('month', now()) + interval '1 month'
);
Either returned boundary can be NULL when the expression has no trigger in the window.
Important Objects
cron_partsis the parsed representation of the minute, hour, day, month, and day-of-week fields.parse_cron(text)parses*, lists, ranges, and step syntax.cron_first_trigger(expr, base_time, strict)searches forward. Withstrict = true, a trigger exactly atbase_timeis skipped.cron_last_trigger(expr, base_time, strict)searches backward and defaults to strict matching.cron_first_last_triggers(expr, start_time, end_time)returns the first and last matches in a window.cron_iterate_n(expr, base_time, strict, direction, max_matches)returns consecutive matches in thenextorprevdirection.
Semantics and Caveats
Expressions use the standard five fields minute hour day month dow; seconds are not accepted. Day-of-week uses 1 = Monday through 7 = Sunday. Results are timestamptz, so session time zone affects the displayed local time and daylight-saving transitions should be tested for local-time schedules.
The extension is pure SQL/PL/pgSQL, relocatable, and has no pg_cron dependency. Its functions are declared immutable and parallel-safe. Version 0.1.0 is marked unstable in the control metadata, so pin behavior and retest edge cases before embedding it in a critical scheduler.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.