跳转到主要内容

currency

Custom PostgreSQL currency type in 1Byte

pg_currency : Custom PostgreSQL currency type in 1Byte

Overview

ID Extension Package Version Category License Language
3680 currency pg_currency 0.0.6 TYPE MIT C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d-r No Yes No Yes yes no

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 0.0.6 19 18 17 16 15 pg_currency plpgsql
RPM PIGSTY 0.0.6 19 18 17 16 15 pg_currency_$v -
DEB PIGSTY 0.0.6 19 18 17 16 15 postgresql-$v-pg-currency -
Linux / PG PG19 PG18 PG17 PG16 PG15
el8.x86_64 N/A PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
el8.aarch64 N/A PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
el9.x86_64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
el9.aarch64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
el10.x86_64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
el10.aarch64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
d12.x86_64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
d12.aarch64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
d13.x86_64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
d13.aarch64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
u22.x86_64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
u22.aarch64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
u24.x86_64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
u24.aarch64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
u26.x86_64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
u26.aarch64 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6 PIGSTY 0.0.6
Package Version OS ORG SIZE File URL
pg_currency_19 0.0.6 el9.x86_64 pigsty 30.2 KiB pg_currency_19-0.0.6-1.git20261006.6c91875PGSTY.el9.x86_64.rpm
pg_currency_19 0.0.6 el9.aarch64 pigsty 30.5 KiB pg_currency_19-0.0.6-1.git20261006.6c91875PGSTY.el9.aarch64.rpm
pg_currency_19 0.0.6 el10.x86_64 pigsty 29.4 KiB pg_currency_19-0.0.6-1.git20261006.6c91875PGSTY.el10.x86_64.rpm
pg_currency_19 0.0.6 el10.aarch64 pigsty 30.1 KiB pg_currency_19-0.0.6-1.git20261006.6c91875PGSTY.el10.aarch64.rpm
postgresql-19-pg-currency 0.0.6 d12.x86_64 pigsty 19.6 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_amd64.deb
postgresql-19-pg-currency 0.0.6 d12.aarch64 pigsty 19.8 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_arm64.deb
postgresql-19-pg-currency 0.0.6 d13.x86_64 pigsty 19.4 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_amd64.deb
postgresql-19-pg-currency 0.0.6 d13.aarch64 pigsty 19.8 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_arm64.deb
postgresql-19-pg-currency 0.0.6 u22.x86_64 pigsty 21.8 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_amd64.deb
postgresql-19-pg-currency 0.0.6 u22.aarch64 pigsty 21.6 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_arm64.deb
postgresql-19-pg-currency 0.0.6 u24.x86_64 pigsty 20.7 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_amd64.deb
postgresql-19-pg-currency 0.0.6 u24.aarch64 pigsty 21.3 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_arm64.deb
postgresql-19-pg-currency 0.0.6 u26.x86_64 pigsty 21.3 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_amd64.deb
postgresql-19-pg-currency 0.0.6 u26.aarch64 pigsty 21.9 KiB postgresql-19-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_currency_18 0.0.6 el8.x86_64 pigsty 28.4 KiB pg_currency_18-0.0.6-1.git20261006.6c91875PGSTY.el8.x86_64.rpm
pg_currency_18 0.0.6 el8.aarch64 pigsty 28.9 KiB pg_currency_18-0.0.6-1.git20261006.6c91875PGSTY.el8.aarch64.rpm
pg_currency_18 0.0.6 el9.x86_64 pigsty 29.5 KiB pg_currency_18-0.0.6-1.git20261006.6c91875PGSTY.el9.x86_64.rpm
pg_currency_18 0.0.6 el9.aarch64 pigsty 29.9 KiB pg_currency_18-0.0.6-1.git20261006.6c91875PGSTY.el9.aarch64.rpm
pg_currency_18 0.0.6 el10.x86_64 pigsty 29.4 KiB pg_currency_18-0.0.6-1.git20261006.6c91875PGSTY.el10.x86_64.rpm
pg_currency_18 0.0.6 el10.aarch64 pigsty 30.1 KiB pg_currency_18-0.0.6-1.git20261006.6c91875PGSTY.el10.aarch64.rpm
postgresql-18-pg-currency 0.0.6 d12.x86_64 pigsty 19.6 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-currency 0.0.6 d12.aarch64 pigsty 19.9 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-currency 0.0.6 d13.x86_64 pigsty 19.4 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_amd64.deb
postgresql-18-pg-currency 0.0.6 d13.aarch64 pigsty 19.9 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_arm64.deb
postgresql-18-pg-currency 0.0.6 u22.x86_64 pigsty 21.8 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_amd64.deb
postgresql-18-pg-currency 0.0.6 u22.aarch64 pigsty 21.6 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_arm64.deb
postgresql-18-pg-currency 0.0.6 u24.x86_64 pigsty 20.7 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_amd64.deb
postgresql-18-pg-currency 0.0.6 u24.aarch64 pigsty 21.3 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_arm64.deb
postgresql-18-pg-currency 0.0.6 u26.x86_64 pigsty 21.3 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_amd64.deb
postgresql-18-pg-currency 0.0.6 u26.aarch64 pigsty 21.8 KiB postgresql-18-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_currency_17 0.0.6 el8.x86_64 pigsty 28.4 KiB pg_currency_17-0.0.6-1.git20261006.6c91875PGSTY.el8.x86_64.rpm
pg_currency_17 0.0.6 el8.aarch64 pigsty 28.8 KiB pg_currency_17-0.0.6-1.git20261006.6c91875PGSTY.el8.aarch64.rpm
pg_currency_17 0.0.6 el9.x86_64 pigsty 29.4 KiB pg_currency_17-0.0.6-1.git20261006.6c91875PGSTY.el9.x86_64.rpm
pg_currency_17 0.0.6 el9.aarch64 pigsty 29.8 KiB pg_currency_17-0.0.6-1.git20261006.6c91875PGSTY.el9.aarch64.rpm
pg_currency_17 0.0.6 el10.x86_64 pigsty 29.4 KiB pg_currency_17-0.0.6-1.git20261006.6c91875PGSTY.el10.x86_64.rpm
pg_currency_17 0.0.6 el10.aarch64 pigsty 30.1 KiB pg_currency_17-0.0.6-1.git20261006.6c91875PGSTY.el10.aarch64.rpm
postgresql-17-pg-currency 0.0.6 d12.x86_64 pigsty 19.5 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-currency 0.0.6 d12.aarch64 pigsty 19.8 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-currency 0.0.6 d13.x86_64 pigsty 19.4 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_amd64.deb
postgresql-17-pg-currency 0.0.6 d13.aarch64 pigsty 19.8 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_arm64.deb
postgresql-17-pg-currency 0.0.6 u22.x86_64 pigsty 23.9 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_amd64.deb
postgresql-17-pg-currency 0.0.6 u22.aarch64 pigsty 23.7 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_arm64.deb
postgresql-17-pg-currency 0.0.6 u24.x86_64 pigsty 20.7 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_amd64.deb
postgresql-17-pg-currency 0.0.6 u24.aarch64 pigsty 21.3 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_arm64.deb
postgresql-17-pg-currency 0.0.6 u26.x86_64 pigsty 21.3 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_amd64.deb
postgresql-17-pg-currency 0.0.6 u26.aarch64 pigsty 21.8 KiB postgresql-17-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_currency_16 0.0.6 el8.x86_64 pigsty 28.4 KiB pg_currency_16-0.0.6-1.git20261006.6c91875PGSTY.el8.x86_64.rpm
pg_currency_16 0.0.6 el8.aarch64 pigsty 28.8 KiB pg_currency_16-0.0.6-1.git20261006.6c91875PGSTY.el8.aarch64.rpm
pg_currency_16 0.0.6 el9.x86_64 pigsty 29.4 KiB pg_currency_16-0.0.6-1.git20261006.6c91875PGSTY.el9.x86_64.rpm
pg_currency_16 0.0.6 el9.aarch64 pigsty 29.8 KiB pg_currency_16-0.0.6-1.git20261006.6c91875PGSTY.el9.aarch64.rpm
pg_currency_16 0.0.6 el10.x86_64 pigsty 29.4 KiB pg_currency_16-0.0.6-1.git20261006.6c91875PGSTY.el10.x86_64.rpm
pg_currency_16 0.0.6 el10.aarch64 pigsty 30.1 KiB pg_currency_16-0.0.6-1.git20261006.6c91875PGSTY.el10.aarch64.rpm
postgresql-16-pg-currency 0.0.6 d12.x86_64 pigsty 19.5 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-currency 0.0.6 d12.aarch64 pigsty 19.8 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-currency 0.0.6 d13.x86_64 pigsty 19.4 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_amd64.deb
postgresql-16-pg-currency 0.0.6 d13.aarch64 pigsty 19.8 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_arm64.deb
postgresql-16-pg-currency 0.0.6 u22.x86_64 pigsty 23.8 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_amd64.deb
postgresql-16-pg-currency 0.0.6 u22.aarch64 pigsty 23.6 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_arm64.deb
postgresql-16-pg-currency 0.0.6 u24.x86_64 pigsty 20.7 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_amd64.deb
postgresql-16-pg-currency 0.0.6 u24.aarch64 pigsty 21.5 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_arm64.deb
postgresql-16-pg-currency 0.0.6 u26.x86_64 pigsty 21.3 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_amd64.deb
postgresql-16-pg-currency 0.0.6 u26.aarch64 pigsty 21.8 KiB postgresql-16-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_currency_15 0.0.6 el8.x86_64 pigsty 28.2 KiB pg_currency_15-0.0.6-1.git20261006.6c91875PGSTY.el8.x86_64.rpm
pg_currency_15 0.0.6 el8.aarch64 pigsty 28.8 KiB pg_currency_15-0.0.6-1.git20261006.6c91875PGSTY.el8.aarch64.rpm
pg_currency_15 0.0.6 el9.x86_64 pigsty 29.2 KiB pg_currency_15-0.0.6-1.git20261006.6c91875PGSTY.el9.x86_64.rpm
pg_currency_15 0.0.6 el9.aarch64 pigsty 29.8 KiB pg_currency_15-0.0.6-1.git20261006.6c91875PGSTY.el9.aarch64.rpm
pg_currency_15 0.0.6 el10.x86_64 pigsty 29.1 KiB pg_currency_15-0.0.6-1.git20261006.6c91875PGSTY.el10.x86_64.rpm
pg_currency_15 0.0.6 el10.aarch64 pigsty 30.1 KiB pg_currency_15-0.0.6-1.git20261006.6c91875PGSTY.el10.aarch64.rpm
postgresql-15-pg-currency 0.0.6 d12.x86_64 pigsty 19.6 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-currency 0.0.6 d12.aarch64 pigsty 21.9 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-currency 0.0.6 d13.x86_64 pigsty 19.5 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_amd64.deb
postgresql-15-pg-currency 0.0.6 d13.aarch64 pigsty 19.8 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~trixie_arm64.deb
postgresql-15-pg-currency 0.0.6 u22.x86_64 pigsty 23.8 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_amd64.deb
postgresql-15-pg-currency 0.0.6 u22.aarch64 pigsty 23.6 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~jammy_arm64.deb
postgresql-15-pg-currency 0.0.6 u24.x86_64 pigsty 20.8 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_amd64.deb
postgresql-15-pg-currency 0.0.6 u24.aarch64 pigsty 21.3 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~noble_arm64.deb
postgresql-15-pg-currency 0.0.6 u26.x86_64 pigsty 21.1 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_amd64.deb
postgresql-15-pg-currency 0.0.6 u26.aarch64 pigsty 21.8 KiB postgresql-15-pg-currency_0.0.6+git20261006.6c91875-1PGSTY~resolute_arm64.deb

Source

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 via package name, for the active PG version
pig install currency;		# install by extension name, for the current active PG version

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;

表格阅读器