timestamp9
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
timestamp9 | 1.4.0 | TYPE | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3890 | timestamp9 | No | Yes | No | Yes | No | No | - |
| Related | prefix semver unit pgpdf pglite_fusion md5hash asn1oid roaringbitmap |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 1.4.0 | 1817161514 | timestamp9 | - |
| RPM | PGDG | 1.4.0 | 1817161514 | timestamp9_$v | - |
| DEB | PIGSTY | 1.4.0 | 1817161514 | postgresql-$v-timestamp9 | - |
Build
You can build the DEB packages for timestamp9 using pig build:
pig build pkg timestamp9 # build DEB packages
Install
You can install timestamp9 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 timestamp9; # Install for current active PG version
pig ext install -y timestamp9 -v 18 # PG 18
pig ext install -y timestamp9 -v 17 # PG 17
pig ext install -y timestamp9 -v 16 # PG 16
pig ext install -y timestamp9 -v 15 # PG 15
pig ext install -y timestamp9 -v 14 # PG 14
dnf install -y timestamp9_18 # PG 18
dnf install -y timestamp9_17 # PG 17
dnf install -y timestamp9_16 # PG 16
dnf install -y timestamp9_15 # PG 15
dnf install -y timestamp9_14 # PG 14
apt install -y postgresql-18-timestamp9 # PG 18
apt install -y postgresql-17-timestamp9 # PG 17
apt install -y postgresql-16-timestamp9 # PG 16
apt install -y postgresql-15-timestamp9 # PG 15
apt install -y postgresql-14-timestamp9 # PG 14
Create Extension:
CREATE EXTENSION timestamp9;
Usage
timestamp9: nanosecond precision timestamp type for PostgreSQL
The timestamp9 extension provides a nanosecond-precision timestamp type stored as a 64-bit integer (nanoseconds since UNIX epoch).
CREATE EXTENSION timestamp9;
Data Type
The timestamp9 type supports timestamps from 1970-01-01 to 2262-04-12 with nanosecond precision.
Input Formats
-- Standard PostgreSQL format
SELECT '2019-09-19 08:30:05'::timestamp9;
-- Full nanosecond precision with timezone
SELECT '2019-09-19 08:30:05.123456789 +0200'::timestamp9;
-- Cast from bigint (nanoseconds since epoch)
SELECT 1568878205123456789::bigint::timestamp9;
Type Conversions
- Cast to/from
timestampandtimestamptz - Cast to/from
date
Nanosecond precision is preserved throughout conversions.
Operators
-- Comparison
SELECT '2019-09-19'::timestamp9 > '2019-09-18'::timestamp9; -- true
-- Arithmetic with intervals
SELECT '2019-09-19 23:00:00.123456789'::timestamp9 + interval '1 day';
-- Subtraction
SELECT '2019-09-20'::timestamp9 - '2019-09-19'::timestamp9;
Functions
SELECT greatest('2019-09-19'::timestamp9, '2019-09-20'::timestamp9);
Index Support
Btree and hash indexes are supported.
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.