currency
currency
pg_currency : Custom PostgreSQL currency type in 1Byte
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3620 | currency
|
pg_currency
|
0.0.3 |
TYPE
|
MIT
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r
|
No
|
Yes
|
No
|
Yes
|
yes
|
no
|
| Relationships | |
|---|---|
| Requires | plpgsql
|
| See Also | l10n_table_dependent_extension
country
pg_xenophile
numeral
prefix
semver
unit
pgpdf
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
0.0.3 |
18
17
16
15
14
|
pg_currency |
plpgsql |
| RPM | PIGSTY
|
0.0.3 |
18
17
16
15
14
|
pg_currency_$v |
- |
| DEB | PIGSTY
|
0.0.3 |
18
17
16
15
14
|
postgresql-$v-pg-currency |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
el8.aarch64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
el9.x86_64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
el9.aarch64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
el10.x86_64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
el10.aarch64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
d12.x86_64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
d12.aarch64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
d13.x86_64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
d13.aarch64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
u22.x86_64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
u22.aarch64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
u24.x86_64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
u24.aarch64
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
PIGSTY 0.0.3
|
Source
pig build pkg pg_currency; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall 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 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
pig install currency -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION currency CASCADE; -- requires plpgsqlUsage
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 | USDOperators
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;Last updated on