uint128
Native uint128 type
Repository
pg-uint/pg-uint128
https://github.com/pg-uint/pg-uint128
Source
pg-uint128-1.2.0.tar.gz
pg-uint128-1.2.0.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_uint128 | 1.2.0 | TYPE | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 3740 | uint128 | No | Yes | No | Yes | No | Yes | - |
| Related | prefix semver unit pgpdf pglite_fusion md5hash asn1oid roaringbitmap |
|---|
breaks on el8 since 1.1 ,fix el8 build problem by adding __has_builtin marco
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.2.0 | 1817161514 | pg_uint128 | - |
| RPM | PIGSTY | 1.2.0 | 1817161514 | pg_uint128_$v | - |
| DEB | PIGSTY | 1.2.0 | 1817161514 | postgresql-$v-pg-uint128 | - |
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
The uint128 extension provides comprehensive unsigned and 128-bit integer types with full operator and index support.
CREATE EXTENSION uint128;
Data Types
| Type | Size | Range |
|---|---|---|
uint1 | 8-bit | 0 to 255 |
uint2 | 16-bit | 0 to 65535 |
uint4 | 32-bit | 0 to 4294967295 |
uint8 | 64-bit | 0 to 18446744073709551615 |
uint16 | 128-bit | 0 to 340282366920938463463374607431768211455 |
int1 | 8-bit | -128 to 127 |
int16 | 128-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
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.