Skip to content

pgmp

pgmp : Multiple Precision Arithmetic extension

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
3700
pgmp
pgmp
1.0.5
TYPE
LGPL-3.0
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-r
No
Yes
No
Yes
yes
no
Relationships
See Also
numeral
unit
pguecc
pgcrypto
prefix
semver
pgpdf
pglite_fusion

missing pg14 on el pgdg repo

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PGDG
1.0.5
18
17
16
15
14
pgmp-
RPM
PGDG
1.0.5
18
17
16
15
14
pgmp_$v-
DEB
PGDG
1.0.5
18
17
16
15
14
postgresql-$v-pgmp-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.4
PGDG 1.0.4
el8.aarch64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.4
PGDG 1.0.4
el9.x86_64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
el9.aarch64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
el10.x86_64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
el10.aarch64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
d12.x86_64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
d12.aarch64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
d13.x86_64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
d13.aarch64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
u22.x86_64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
u22.aarch64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
u24.x86_64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
u24.aarch64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
u26.x86_64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
u26.aarch64
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PGDG 1.0.5
PackageVersionOSORGSIZEFile URL
pgmp_181.0.5el8.x86_64pgdg41.8 KiBpgmp_18-1.0.5-4PGDG.rhel8.x86_64.rpm
pgmp_181.0.5el8.aarch64pgdg39.9 KiBpgmp_18-1.0.5-4PGDG.rhel8.aarch64.rpm
pgmp_181.0.5el9.x86_64pgdg42.9 KiBpgmp_18-1.0.5-6PGDG.rhel9.8.x86_64.rpm
pgmp_181.0.5el9.x86_64pgdg42.9 KiBpgmp_18-1.0.5-4PGDG.rhel9.x86_64.rpm
pgmp_181.0.5el9.aarch64pgdg41.4 KiBpgmp_18-1.0.5-6PGDG.rhel9.8.aarch64.rpm
pgmp_181.0.5el9.aarch64pgdg41.4 KiBpgmp_18-1.0.5-4PGDG.rhel9.aarch64.rpm
pgmp_181.0.5el10.x86_64pgdg43.9 KiBpgmp_18-1.0.5-6PGDG.rhel10.2.x86_64.rpm
pgmp_181.0.5el10.x86_64pgdg44.2 KiBpgmp_18-1.0.5-4PGDG.rhel10.x86_64.rpm
pgmp_181.0.5el10.aarch64pgdg42.6 KiBpgmp_18-1.0.5-6PGDG.rhel10.2.aarch64.rpm
pgmp_181.0.5el10.aarch64pgdg42.9 KiBpgmp_18-1.0.5-4PGDG.rhel10.aarch64.rpm
postgresql-18-pgmp1.0.5d12.x86_64pgdg100.6 KiBpostgresql-18-pgmp_1.0.5-5.pgdg12+1_amd64.deb
postgresql-18-pgmp1.0.5d12.x86_64pgdg100.5 KiBpostgresql-18-pgmp_1.0.5-4.pgdg12+1_amd64.deb
postgresql-18-pgmp1.0.5d12.aarch64pgdg99.5 KiBpostgresql-18-pgmp_1.0.5-5.pgdg12+1_arm64.deb
postgresql-18-pgmp1.0.5d12.aarch64pgdg99.4 KiBpostgresql-18-pgmp_1.0.5-4.pgdg12+1_arm64.deb
postgresql-18-pgmp1.0.5d13.x86_64pgdg100.5 KiBpostgresql-18-pgmp_1.0.5-5.pgdg13+1_amd64.deb
postgresql-18-pgmp1.0.5d13.x86_64pgdg100.6 KiBpostgresql-18-pgmp_1.0.5-4.pgdg13+1_amd64.deb
postgresql-18-pgmp1.0.5d13.aarch64pgdg99.6 KiBpostgresql-18-pgmp_1.0.5-5.pgdg13+1_arm64.deb
postgresql-18-pgmp1.0.5d13.aarch64pgdg99.5 KiBpostgresql-18-pgmp_1.0.5-4.pgdg13+1_arm64.deb
postgresql-18-pgmp1.0.5u22.x86_64pgdg102.8 KiBpostgresql-18-pgmp_1.0.5-5.pgdg22.04+1_amd64.deb
postgresql-18-pgmp1.0.5u22.x86_64pgdg102.7 KiBpostgresql-18-pgmp_1.0.5-4.pgdg22.04+1_amd64.deb
postgresql-18-pgmp1.0.5u22.aarch64pgdg100.9 KiBpostgresql-18-pgmp_1.0.5-5.pgdg22.04+1_arm64.deb
postgresql-18-pgmp1.0.5u22.aarch64pgdg100.9 KiBpostgresql-18-pgmp_1.0.5-4.pgdg22.04+1_arm64.deb
postgresql-18-pgmp1.0.5u24.x86_64pgdg101.1 KiBpostgresql-18-pgmp_1.0.5-5.pgdg24.04+1_amd64.deb
postgresql-18-pgmp1.0.5u24.x86_64pgdg101.0 KiBpostgresql-18-pgmp_1.0.5-4.pgdg24.04+1_amd64.deb
postgresql-18-pgmp1.0.5u24.aarch64pgdg99.8 KiBpostgresql-18-pgmp_1.0.5-5.pgdg24.04+1_arm64.deb
postgresql-18-pgmp1.0.5u24.aarch64pgdg99.8 KiBpostgresql-18-pgmp_1.0.5-4.pgdg24.04+1_arm64.deb
postgresql-18-pgmp1.0.5u26.x86_64pgdg101.3 KiBpostgresql-18-pgmp_1.0.5-5.pgdg26.04+1_amd64.deb
postgresql-18-pgmp1.0.5u26.x86_64pgdg101.3 KiBpostgresql-18-pgmp_1.0.5-4.pgdg26.04+1_amd64.deb
postgresql-18-pgmp1.0.5u26.aarch64pgdg99.7 KiBpostgresql-18-pgmp_1.0.5-5.pgdg26.04+1_arm64.deb
postgresql-18-pgmp1.0.5u26.aarch64pgdg99.9 KiBpostgresql-18-pgmp_1.0.5-4.pgdg26.04+1_arm64.deb

Source

Install

Make sure PGDG repo available:

pig repo add pgdg -u    # add pgdg repo and update cache

Install this extension with pig:

pig install pgmp;		# install via package name, for the active PG version

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

Create this extension with:

CREATE EXTENSION pgmp;

Usage

pgmp: multiple precision arithmetic (GMP) for PostgreSQL

The pgmp extension integrates the GNU Multiple Precision (GMP) library into PostgreSQL, providing arbitrary-precision integer and rational number types.

CREATE EXTENSION pgmp;

Data Types

  • mpz: Arbitrary-size integers, limited only by PostgreSQL’s 1GB varlena maximum
  • mpq: Arbitrary-precision rational numbers for exact fractional arithmetic

Basic Usage

-- Arbitrary precision integers
SELECT '123456789012345678901234567890'::mpz * 2;

-- Exact rational arithmetic (no rounding)
SELECT '1'::mpq / '3'::mpq;  -- 1/3

-- Mixed arithmetic with native PostgreSQL types
SELECT 42::mpz + '100'::mpz;

Operators

Standard arithmetic operators (+, -, *, /, %) and comparison operators (=, <>, <, >, <=, >=) are supported for both mpz and mpq.

Functions

The extension exposes all GMP library functions for these types, including:

  • Prime number functions
  • Random number generation
  • Factorization
  • GCD, LCM, and other number theory functions

Index Support

Both mpz and mpq support btree and hash indexes for efficient queries and sorting.

Full documentation: https://www.varrazzo.com/pgmp/

Last updated on