Skip to content

currency

Custom PostgreSQL currency type in 1Byte

pg_currency · Custom PostgreSQL currency type in 1Byte

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
3680currencypg_currency0.0.6TYPEMITC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-rNoYesNoYesyesno

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.0.619 18 17 16 15pg_currencyplpgsql
RPMPIGSTY0.0.619 18 17 16 15pg_currency_$v-
DEBPIGSTY0.0.619 18 17 16 15postgresql-$v-pg-currency-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
el8.aarch64N/APIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
el9.x86_64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
el9.aarch64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
el10.x86_64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
el10.aarch64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
d12.x86_64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
d12.aarch64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
d13.x86_64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
d13.aarch64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
u22.x86_64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
u22.aarch64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
u24.x86_64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
u24.aarch64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
u26.x86_64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
u26.aarch64PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6PIGSTY 0.0.6
PackageVersionOSORGSIZEFile URL
pg_currency_190.0.6el9.x86_64pigsty30.2 KiBpg_currency_19-0.0.6-2PGSTY.el9.x86_64.rpm
pg_currency_190.0.6el9.aarch64pigsty30.5 KiBpg_currency_19-0.0.6-2PGSTY.el9.aarch64.rpm
pg_currency_190.0.6el10.x86_64pigsty29.4 KiBpg_currency_19-0.0.6-2PGSTY.el10.x86_64.rpm
pg_currency_190.0.6el10.aarch64pigsty30.1 KiBpg_currency_19-0.0.6-2PGSTY.el10.aarch64.rpm
postgresql-19-pg-currency0.0.6d12.x86_64pigsty19.6 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~bookworm_amd64.deb
postgresql-19-pg-currency0.0.6d12.aarch64pigsty19.9 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~bookworm_arm64.deb
postgresql-19-pg-currency0.0.6d13.x86_64pigsty19.5 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~trixie_amd64.deb
postgresql-19-pg-currency0.0.6d13.aarch64pigsty19.9 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~trixie_arm64.deb
postgresql-19-pg-currency0.0.6u22.x86_64pigsty21.8 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~jammy_amd64.deb
postgresql-19-pg-currency0.0.6u22.aarch64pigsty21.6 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~jammy_arm64.deb
postgresql-19-pg-currency0.0.6u24.x86_64pigsty20.8 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~noble_amd64.deb
postgresql-19-pg-currency0.0.6u24.aarch64pigsty21.4 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~noble_arm64.deb
postgresql-19-pg-currency0.0.6u26.x86_64pigsty21.4 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~resolute_amd64.deb
postgresql-19-pg-currency0.0.6u26.aarch64pigsty21.9 KiBpostgresql-19-pg-currency_0.0.6-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_currency_180.0.6el8.x86_64pigsty28.5 KiBpg_currency_18-0.0.6-1.git20261006.6c91875PGSTY.el8.x86_64.rpm
pg_currency_180.0.6el8.aarch64pigsty29.4 KiBpg_currency_18-0.0.6-1.git20261006.6c91875PGSTY.el8.aarch64.rpm
pg_currency_180.0.6el9.x86_64pigsty30.3 KiBpg_currency_18-0.0.6-2PGSTY.el9.x86_64.rpm
pg_currency_180.0.6el9.aarch64pigsty30.5 KiBpg_currency_18-0.0.6-2PGSTY.el9.aarch64.rpm
pg_currency_180.0.6el10.x86_64pigsty29.4 KiBpg_currency_18-0.0.6-2PGSTY.el10.x86_64.rpm
pg_currency_180.0.6el10.aarch64pigsty30.1 KiBpg_currency_18-0.0.6-2PGSTY.el10.aarch64.rpm
postgresql-18-pg-currency0.0.6d12.x86_64pigsty19.6 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~bookworm_amd64.deb
postgresql-18-pg-currency0.0.6d12.aarch64pigsty19.9 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~bookworm_arm64.deb
postgresql-18-pg-currency0.0.6d13.x86_64pigsty19.4 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~trixie_amd64.deb
postgresql-18-pg-currency0.0.6d13.aarch64pigsty19.9 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~trixie_arm64.deb
postgresql-18-pg-currency0.0.6u22.x86_64pigsty21.8 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~jammy_amd64.deb
postgresql-18-pg-currency0.0.6u22.aarch64pigsty21.6 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~jammy_arm64.deb
postgresql-18-pg-currency0.0.6u24.x86_64pigsty20.7 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~noble_amd64.deb
postgresql-18-pg-currency0.0.6u24.aarch64pigsty21.3 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~noble_arm64.deb
postgresql-18-pg-currency0.0.6u26.x86_64pigsty21.3 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~resolute_amd64.deb
postgresql-18-pg-currency0.0.6u26.aarch64pigsty21.9 KiBpostgresql-18-pg-currency_0.0.6-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_currency_170.0.6el8.x86_64pigsty28.4 KiBpg_currency_17-0.0.6-1.git20261006.6c91875PGSTY.el8.x86_64.rpm
pg_currency_170.0.6el8.aarch64pigsty29.3 KiBpg_currency_17-0.0.6-1.git20261006.6c91875PGSTY.el8.aarch64.rpm
pg_currency_170.0.6el9.x86_64pigsty30.2 KiBpg_currency_17-0.0.6-2PGSTY.el9.x86_64.rpm
pg_currency_170.0.6el9.aarch64pigsty30.5 KiBpg_currency_17-0.0.6-2PGSTY.el9.aarch64.rpm
pg_currency_170.0.6el10.x86_64pigsty29.4 KiBpg_currency_17-0.0.6-2PGSTY.el10.x86_64.rpm
pg_currency_170.0.6el10.aarch64pigsty30.1 KiBpg_currency_17-0.0.6-2PGSTY.el10.aarch64.rpm
postgresql-17-pg-currency0.0.6d12.x86_64pigsty19.6 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~bookworm_amd64.deb
postgresql-17-pg-currency0.0.6d12.aarch64pigsty19.8 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~bookworm_arm64.deb
postgresql-17-pg-currency0.0.6d13.x86_64pigsty19.4 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~trixie_amd64.deb
postgresql-17-pg-currency0.0.6d13.aarch64pigsty19.9 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~trixie_arm64.deb
postgresql-17-pg-currency0.0.6u22.x86_64pigsty23.9 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~jammy_amd64.deb
postgresql-17-pg-currency0.0.6u22.aarch64pigsty23.7 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~jammy_arm64.deb
postgresql-17-pg-currency0.0.6u24.x86_64pigsty20.7 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~noble_amd64.deb
postgresql-17-pg-currency0.0.6u24.aarch64pigsty21.3 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~noble_arm64.deb
postgresql-17-pg-currency0.0.6u26.x86_64pigsty21.4 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~resolute_amd64.deb
postgresql-17-pg-currency0.0.6u26.aarch64pigsty21.9 KiBpostgresql-17-pg-currency_0.0.6-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_currency_160.0.6el8.x86_64pigsty28.4 KiBpg_currency_16-0.0.6-1.git20261006.6c91875PGSTY.el8.x86_64.rpm
pg_currency_160.0.6el8.aarch64pigsty29.3 KiBpg_currency_16-0.0.6-1.git20261006.6c91875PGSTY.el8.aarch64.rpm
pg_currency_160.0.6el9.x86_64pigsty30.2 KiBpg_currency_16-0.0.6-2PGSTY.el9.x86_64.rpm
pg_currency_160.0.6el9.aarch64pigsty30.5 KiBpg_currency_16-0.0.6-2PGSTY.el9.aarch64.rpm
pg_currency_160.0.6el10.x86_64pigsty29.4 KiBpg_currency_16-0.0.6-2PGSTY.el10.x86_64.rpm
pg_currency_160.0.6el10.aarch64pigsty30.1 KiBpg_currency_16-0.0.6-2PGSTY.el10.aarch64.rpm
postgresql-16-pg-currency0.0.6d12.x86_64pigsty19.5 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~bookworm_amd64.deb
postgresql-16-pg-currency0.0.6d12.aarch64pigsty19.9 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~bookworm_arm64.deb
postgresql-16-pg-currency0.0.6d13.x86_64pigsty19.4 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~trixie_amd64.deb
postgresql-16-pg-currency0.0.6d13.aarch64pigsty19.8 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~trixie_arm64.deb
postgresql-16-pg-currency0.0.6u22.x86_64pigsty23.8 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~jammy_amd64.deb
postgresql-16-pg-currency0.0.6u22.aarch64pigsty23.7 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~jammy_arm64.deb
postgresql-16-pg-currency0.0.6u24.x86_64pigsty20.8 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~noble_amd64.deb
postgresql-16-pg-currency0.0.6u24.aarch64pigsty21.3 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~noble_arm64.deb
postgresql-16-pg-currency0.0.6u26.x86_64pigsty21.3 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~resolute_amd64.deb
postgresql-16-pg-currency0.0.6u26.aarch64pigsty21.9 KiBpostgresql-16-pg-currency_0.0.6-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_currency_150.0.6el8.x86_64pigsty28.2 KiBpg_currency_15-0.0.6-1.git20261006.6c91875PGSTY.el8.x86_64.rpm
pg_currency_150.0.6el8.aarch64pigsty29.3 KiBpg_currency_15-0.0.6-1.git20261006.6c91875PGSTY.el8.aarch64.rpm
pg_currency_150.0.6el9.x86_64pigsty30.3 KiBpg_currency_15-0.0.6-2PGSTY.el9.x86_64.rpm
pg_currency_150.0.6el9.aarch64pigsty30.5 KiBpg_currency_15-0.0.6-2PGSTY.el9.aarch64.rpm
pg_currency_150.0.6el10.x86_64pigsty29.1 KiBpg_currency_15-0.0.6-2PGSTY.el10.x86_64.rpm
pg_currency_150.0.6el10.aarch64pigsty30.1 KiBpg_currency_15-0.0.6-2PGSTY.el10.aarch64.rpm
postgresql-15-pg-currency0.0.6d12.x86_64pigsty19.7 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~bookworm_amd64.deb
postgresql-15-pg-currency0.0.6d12.aarch64pigsty19.8 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~bookworm_arm64.deb
postgresql-15-pg-currency0.0.6d13.x86_64pigsty19.5 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~trixie_amd64.deb
postgresql-15-pg-currency0.0.6d13.aarch64pigsty19.9 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~trixie_arm64.deb
postgresql-15-pg-currency0.0.6u22.x86_64pigsty23.8 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~jammy_amd64.deb
postgresql-15-pg-currency0.0.6u22.aarch64pigsty23.7 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~jammy_arm64.deb
postgresql-15-pg-currency0.0.6u24.x86_64pigsty20.8 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~noble_amd64.deb
postgresql-15-pg-currency0.0.6u24.aarch64pigsty21.3 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~noble_arm64.deb
postgresql-15-pg-currency0.0.6u26.x86_64pigsty21.1 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~resolute_amd64.deb
postgresql-15-pg-currency0.0.6u26.aarch64pigsty21.9 KiBpostgresql-15-pg-currency_0.0.6-2PGSTY~resolute_arm64.deb

Source

pg-currency-0.0.6+git20261006.6c91875.tar.gz

pig build pkg pg_currency;		# 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_currency;		# install by package name
pig install currency;		# install by extension name

pig install currency -v 19;   # install for PG 19
pig install currency -v 18;   # install for PG 18
pig install currency -v 17;   # install for PG 17
pig install currency -v 16;   # install for PG 16
pig install currency -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION currency CASCADE; -- requires plpgsql

Usage

currency: ISO 4217 currency code type

The currency extension provides a data type for ISO 4217 currency codes using only a single byte of storage per value.

CREATE EXTENSION currency;

CREATE TABLE transactions (
    id                serial,
    payment_currency  currency
);

INSERT INTO transactions VALUES (1, 'USD'), (2, 'EUR'), (3, 'USD');

SELECT * FROM transactions ORDER BY payment_currency;
 id | payment_currency
----+------------------
  2 | EUR
  1 | USD
  3 | USD

Operators

Standard comparison operators are supported: =, <>, <, >, <=, >=.

B-tree index support is included for efficient ordering and lookups.

Functions

-- List all supported currency codes
SELECT * FROM supported_currencies() currency ORDER BY currency;

Table reader