pg_when

pg_when

pg_when : Natural language time parsing for PostgreSQL

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
1120
pg_when
pg_when
0.1.9
TIME
MIT
Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--
No
Yes
No
Yes
no
no

manually upgraded PGRX from 0.15.0 to 0.17.0 by Vonng

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
0.1.9
18
17
16
15
14
pg_when-
RPM
PIGSTY
0.1.9
18
17
16
15
14
pg_when_$v-
DEB
PIGSTY
0.1.9
18
17
16
15
14
postgresql-$v-pg-when-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
el8.aarch64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
el9.x86_64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
el9.aarch64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
el10.x86_64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
el10.aarch64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
d12.x86_64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
d12.aarch64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
d13.x86_64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
d13.aarch64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
u22.x86_64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
u22.aarch64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
u24.x86_64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
u24.aarch64
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PIGSTY 0.1.9
PackageVersionOSORGSIZEFile URL
pg_when_180.1.9el8.x86_64pigsty439.5 KiBpg_when_18-0.1.9-1PIGSTY.el8.x86_64.rpm
pg_when_180.1.9el8.aarch64pigsty328.5 KiBpg_when_18-0.1.9-1PIGSTY.el8.aarch64.rpm
pg_when_180.1.9el9.x86_64pigsty456.1 KiBpg_when_18-0.1.9-1PIGSTY.el9.x86_64.rpm
pg_when_180.1.9el9.aarch64pigsty347.9 KiBpg_when_18-0.1.9-1PIGSTY.el9.aarch64.rpm
pg_when_180.1.9el10.x86_64pigsty456.2 KiBpg_when_18-0.1.9-1PIGSTY.el10.x86_64.rpm
pg_when_180.1.9el10.aarch64pigsty347.6 KiBpg_when_18-0.1.9-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-when0.1.9d12.x86_64pigsty364.2 KiBpostgresql-18-pg-when_0.1.9-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-when0.1.9d12.aarch64pigsty259.7 KiBpostgresql-18-pg-when_0.1.9-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-when0.1.9d13.x86_64pigsty364.2 KiBpostgresql-18-pg-when_0.1.9-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-when0.1.9d13.aarch64pigsty259.6 KiBpostgresql-18-pg-when_0.1.9-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-when0.1.9u22.x86_64pigsty406.7 KiBpostgresql-18-pg-when_0.1.9-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-when0.1.9u22.aarch64pigsty298.4 KiBpostgresql-18-pg-when_0.1.9-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-when0.1.9u24.x86_64pigsty403.4 KiBpostgresql-18-pg-when_0.1.9-1PIGSTY~noble_amd64.deb
postgresql-18-pg-when0.1.9u24.aarch64pigsty296.1 KiBpostgresql-18-pg-when_0.1.9-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_when_170.1.9el8.x86_64pigsty439.7 KiBpg_when_17-0.1.9-1PIGSTY.el8.x86_64.rpm
pg_when_170.1.9el8.aarch64pigsty328.5 KiBpg_when_17-0.1.9-1PIGSTY.el8.aarch64.rpm
pg_when_170.1.9el9.x86_64pigsty456.1 KiBpg_when_17-0.1.9-1PIGSTY.el9.x86_64.rpm
pg_when_170.1.9el9.aarch64pigsty348.0 KiBpg_when_17-0.1.9-1PIGSTY.el9.aarch64.rpm
pg_when_170.1.9el10.x86_64pigsty456.3 KiBpg_when_17-0.1.9-1PIGSTY.el10.x86_64.rpm
pg_when_170.1.9el10.aarch64pigsty347.5 KiBpg_when_17-0.1.9-1PIGSTY.el10.aarch64.rpm
postgresql-17-pg-when0.1.9d12.x86_64pigsty364.5 KiBpostgresql-17-pg-when_0.1.9-1PIGSTY~bookworm_amd64.deb
postgresql-17-pg-when0.1.9d12.aarch64pigsty259.7 KiBpostgresql-17-pg-when_0.1.9-1PIGSTY~bookworm_arm64.deb
postgresql-17-pg-when0.1.9d13.x86_64pigsty364.7 KiBpostgresql-17-pg-when_0.1.9-1PIGSTY~trixie_amd64.deb
postgresql-17-pg-when0.1.9d13.aarch64pigsty259.6 KiBpostgresql-17-pg-when_0.1.9-1PIGSTY~trixie_arm64.deb
postgresql-17-pg-when0.1.9u22.x86_64pigsty406.4 KiBpostgresql-17-pg-when_0.1.9-1PIGSTY~jammy_amd64.deb
postgresql-17-pg-when0.1.9u22.aarch64pigsty298.5 KiBpostgresql-17-pg-when_0.1.9-1PIGSTY~jammy_arm64.deb
postgresql-17-pg-when0.1.9u24.x86_64pigsty403.5 KiBpostgresql-17-pg-when_0.1.9-1PIGSTY~noble_amd64.deb
postgresql-17-pg-when0.1.9u24.aarch64pigsty296.1 KiBpostgresql-17-pg-when_0.1.9-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_when_160.1.9el8.x86_64pigsty439.8 KiBpg_when_16-0.1.9-1PIGSTY.el8.x86_64.rpm
pg_when_160.1.9el8.aarch64pigsty328.5 KiBpg_when_16-0.1.9-1PIGSTY.el8.aarch64.rpm
pg_when_160.1.9el9.x86_64pigsty456.2 KiBpg_when_16-0.1.9-1PIGSTY.el9.x86_64.rpm
pg_when_160.1.9el9.aarch64pigsty348.0 KiBpg_when_16-0.1.9-1PIGSTY.el9.aarch64.rpm
pg_when_160.1.9el10.x86_64pigsty456.4 KiBpg_when_16-0.1.9-1PIGSTY.el10.x86_64.rpm
pg_when_160.1.9el10.aarch64pigsty347.6 KiBpg_when_16-0.1.9-1PIGSTY.el10.aarch64.rpm
postgresql-16-pg-when0.1.9d12.x86_64pigsty363.9 KiBpostgresql-16-pg-when_0.1.9-1PIGSTY~bookworm_amd64.deb
postgresql-16-pg-when0.1.9d12.aarch64pigsty259.6 KiBpostgresql-16-pg-when_0.1.9-1PIGSTY~bookworm_arm64.deb
postgresql-16-pg-when0.1.9d13.x86_64pigsty364.0 KiBpostgresql-16-pg-when_0.1.9-1PIGSTY~trixie_amd64.deb
postgresql-16-pg-when0.1.9d13.aarch64pigsty259.6 KiBpostgresql-16-pg-when_0.1.9-1PIGSTY~trixie_arm64.deb
postgresql-16-pg-when0.1.9u22.x86_64pigsty406.5 KiBpostgresql-16-pg-when_0.1.9-1PIGSTY~jammy_amd64.deb
postgresql-16-pg-when0.1.9u22.aarch64pigsty298.4 KiBpostgresql-16-pg-when_0.1.9-1PIGSTY~jammy_arm64.deb
postgresql-16-pg-when0.1.9u24.x86_64pigsty403.2 KiBpostgresql-16-pg-when_0.1.9-1PIGSTY~noble_amd64.deb
postgresql-16-pg-when0.1.9u24.aarch64pigsty296.1 KiBpostgresql-16-pg-when_0.1.9-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_when_150.1.9el8.x86_64pigsty439.2 KiBpg_when_15-0.1.9-1PIGSTY.el8.x86_64.rpm
pg_when_150.1.9el8.aarch64pigsty328.6 KiBpg_when_15-0.1.9-1PIGSTY.el8.aarch64.rpm
pg_when_150.1.9el9.x86_64pigsty456.1 KiBpg_when_15-0.1.9-1PIGSTY.el9.x86_64.rpm
pg_when_150.1.9el9.aarch64pigsty348.3 KiBpg_when_15-0.1.9-1PIGSTY.el9.aarch64.rpm
pg_when_150.1.9el10.x86_64pigsty456.2 KiBpg_when_15-0.1.9-1PIGSTY.el10.x86_64.rpm
pg_when_150.1.9el10.aarch64pigsty347.6 KiBpg_when_15-0.1.9-1PIGSTY.el10.aarch64.rpm
postgresql-15-pg-when0.1.9d12.x86_64pigsty364.1 KiBpostgresql-15-pg-when_0.1.9-1PIGSTY~bookworm_amd64.deb
postgresql-15-pg-when0.1.9d12.aarch64pigsty259.7 KiBpostgresql-15-pg-when_0.1.9-1PIGSTY~bookworm_arm64.deb
postgresql-15-pg-when0.1.9d13.x86_64pigsty363.9 KiBpostgresql-15-pg-when_0.1.9-1PIGSTY~trixie_amd64.deb
postgresql-15-pg-when0.1.9d13.aarch64pigsty259.5 KiBpostgresql-15-pg-when_0.1.9-1PIGSTY~trixie_arm64.deb
postgresql-15-pg-when0.1.9u22.x86_64pigsty406.5 KiBpostgresql-15-pg-when_0.1.9-1PIGSTY~jammy_amd64.deb
postgresql-15-pg-when0.1.9u22.aarch64pigsty298.6 KiBpostgresql-15-pg-when_0.1.9-1PIGSTY~jammy_arm64.deb
postgresql-15-pg-when0.1.9u24.x86_64pigsty403.3 KiBpostgresql-15-pg-when_0.1.9-1PIGSTY~noble_amd64.deb
postgresql-15-pg-when0.1.9u24.aarch64pigsty296.1 KiBpostgresql-15-pg-when_0.1.9-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_when_140.1.9el8.x86_64pigsty439.3 KiBpg_when_14-0.1.9-1PIGSTY.el8.x86_64.rpm
pg_when_140.1.9el8.aarch64pigsty328.5 KiBpg_when_14-0.1.9-1PIGSTY.el8.aarch64.rpm
pg_when_140.1.9el9.x86_64pigsty455.7 KiBpg_when_14-0.1.9-1PIGSTY.el9.x86_64.rpm
pg_when_140.1.9el9.aarch64pigsty348.0 KiBpg_when_14-0.1.9-1PIGSTY.el9.aarch64.rpm
pg_when_140.1.9el10.x86_64pigsty456.0 KiBpg_when_14-0.1.9-1PIGSTY.el10.x86_64.rpm
pg_when_140.1.9el10.aarch64pigsty347.6 KiBpg_when_14-0.1.9-1PIGSTY.el10.aarch64.rpm
postgresql-14-pg-when0.1.9d12.x86_64pigsty364.2 KiBpostgresql-14-pg-when_0.1.9-1PIGSTY~bookworm_amd64.deb
postgresql-14-pg-when0.1.9d12.aarch64pigsty259.6 KiBpostgresql-14-pg-when_0.1.9-1PIGSTY~bookworm_arm64.deb
postgresql-14-pg-when0.1.9d13.x86_64pigsty364.2 KiBpostgresql-14-pg-when_0.1.9-1PIGSTY~trixie_amd64.deb
postgresql-14-pg-when0.1.9d13.aarch64pigsty259.5 KiBpostgresql-14-pg-when_0.1.9-1PIGSTY~trixie_arm64.deb
postgresql-14-pg-when0.1.9u22.x86_64pigsty406.2 KiBpostgresql-14-pg-when_0.1.9-1PIGSTY~jammy_amd64.deb
postgresql-14-pg-when0.1.9u22.aarch64pigsty298.4 KiBpostgresql-14-pg-when_0.1.9-1PIGSTY~jammy_arm64.deb
postgresql-14-pg-when0.1.9u24.x86_64pigsty403.2 KiBpostgresql-14-pg-when_0.1.9-1PIGSTY~noble_amd64.deb
postgresql-14-pg-when0.1.9u24.aarch64pigsty296.1 KiBpostgresql-14-pg-when_0.1.9-1PIGSTY~noble_arm64.deb

Source

pig build pkg pg_when;		# build rpm/deb

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_when;		# install via package name, for the active PG version

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

Create this extension with:

CREATE EXTENSION pg_when;

Usage

Sources: README and project repo.

pg-when is a PostgreSQL extension for creating time values from natural-language phrases. It exposes the same parsed expression through multiple return formats: when_is, seconds_at, millis_at, micros_at, and nanos_at.

The query syntax combines up to three parts:

SELECT when_is('<date> at <time> in <timezone>');
SELECT when_is('<date>');
SELECT when_is('<time> in <timezone>');
SELECT when_is('<date> at <time>');

If no timezone is provided, the extension defaults to UTC.

Supported Components

<date> can be relative or exact.

Relative date examples from the README include:

  • today
  • yesterday
  • tomorrow
  • next week
  • last month
  • this friday
  • 5 days ago
  • in 2 years

Exact dates can be written as:

  • YYYY-MM-DD or YYYY/MM/DD
  • DD-MM-YYYY or DD/MM/YYYY
  • Month D, YYYY
  • D Month YYYY

<time> can also be relative or exact.

Relative time examples include:

  • noon
  • midnight
  • morning
  • evening
  • next hour
  • previous minute
  • this hour

Exact times can be written in 12-hour or 24-hour forms such as 8:30 pm or 15:45.

Timezones accept either IANA names or UTC offsets, for example America/New_York or UTC-08:00.

Examples

SELECT when_is('5 days ago at this hour in Asia/Tokyo');
SELECT when_is('next friday at 8:00 pm in America/New_York');
SELECT when_is('in 2 months at midnight in UTC-8');
SELECT when_is('last monday at 22:30');
SELECT when_is('December 31, 2026 at evening');

Deployment

The upstream README shows Docker images for PostgreSQL 13 through 18. That matches the package metadata in this repository.

Last updated on