uint128

Native uint128 type

Overview

PackageVersionCategoryLicenseLanguage
pg_uint1281.2.0TYPEPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
3740uint128NoYesNoYesNoYes-
Relatedprefix semver unit pgpdf pglite_fusion md5hash asn1oid roaringbitmap

breaks on el8 since 1.1 ,fix el8 build problem by adding __has_builtin marco

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY1.2.01817161514pg_uint128-
RPMPIGSTY1.2.01817161514pg_uint128_$v-
DEBPIGSTY1.2.01817161514postgresql-$v-pg-uint128-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
d13.x86_64
d13.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
u22.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
u22.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
u24.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
u24.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0

Build

You can build the RPM / DEB packages for pg_uint128 using pig build:

pig build pkg pg_uint128         # build RPM / DEB packages

Install

You can install pg_uint128 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 pg_uint128;          # Install for current active PG version
pig ext install -y pg_uint128 -v 18  # PG 18
pig ext install -y pg_uint128 -v 17  # PG 17
pig ext install -y pg_uint128 -v 16  # PG 16
pig ext install -y pg_uint128 -v 15  # PG 15
pig ext install -y pg_uint128 -v 14  # PG 14
dnf install -y pg_uint128_18       # PG 18
dnf install -y pg_uint128_17       # PG 17
dnf install -y pg_uint128_16       # PG 16
dnf install -y pg_uint128_15       # PG 15
dnf install -y pg_uint128_14       # PG 14
apt install -y postgresql-18-pg-uint128   # PG 18
apt install -y postgresql-17-pg-uint128   # PG 17
apt install -y postgresql-16-pg-uint128   # PG 16
apt install -y postgresql-15-pg-uint128   # PG 15
apt install -y postgresql-14-pg-uint128   # PG 14

Create Extension:

CREATE EXTENSION uint128;

Usage

uint128: unsigned 128-bit integer type for PostgreSQL

The uint128 extension provides comprehensive unsigned and 128-bit integer types with full operator and index support.

CREATE EXTENSION uint128;

Data Types

TypeSizeRange
uint18-bit0 to 255
uint216-bit0 to 65535
uint432-bit0 to 4294967295
uint864-bit0 to 18446744073709551615
uint16128-bit0 to 340282366920938463463374607431768211455
int18-bit-128 to 127
int16128-bit-170141183460469231731687303715884105728 to 170141183460469231731687303715884105727

Operators

  • Arithmetic: +, -, *, /, %
  • Bitwise: # (XOR), & (AND), | (OR), ~ (NOT), << (left shift), >> (right shift)
  • Comparison: =, <>, >, <, >=, <=

Mixed-type arithmetic between signed and unsigned types is supported.

Features

  • Range types for all integer types (uint1range, uint16range, etc.) with GiST indexing
  • Casts to/from numeric, real, double, uuid (uint16 only), json, jsonb
  • Aggregate functions: SUM, AVG, MIN, MAX
  • generate_series() support for all types
  • Btree and hash index support
  • Binary send/receive protocol support

Last Modified 2026-03-12: add pg extension catalog (95749bf)