跳转到主要内容

country

Country data type, ISO 3166-1

pg_country : Country data type, ISO 3166-1

Overview

ID Extension Package Version Category License Language
3660 country pg_country 0.0.4 TYPE PostgreSQL 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.4 19 18 17 16 15 pg_country -
RPM PIGSTY 0.0.4 19 18 17 16 15 pg_country_$v -
DEB PIGSTY 0.0.4 19 18 17 16 15 postgresql-$v-pg-country -
Linux / PG PG19 PG18 PG17 PG16 PG15
el8.x86_64 N/A PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
el8.aarch64 N/A PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
el9.x86_64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
el9.aarch64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
el10.x86_64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
el10.aarch64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
d12.x86_64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
d12.aarch64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
d13.x86_64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
d13.aarch64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
u22.x86_64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
u22.aarch64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
u24.x86_64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
u24.aarch64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
u26.x86_64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
u26.aarch64 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4 PIGSTY 0.0.4
Package Version OS ORG SIZE File URL
pg_country_19 0.0.4 el9.x86_64 pigsty 48.7 KiB pg_country_19-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_19 0.0.4 el9.aarch64 pigsty 49.5 KiB pg_country_19-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_19 0.0.4 el10.x86_64 pigsty 48.4 KiB pg_country_19-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_19 0.0.4 el10.aarch64 pigsty 49.3 KiB pg_country_19-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-19-pg-country 0.0.4 d12.x86_64 pigsty 47.5 KiB postgresql-19-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-19-pg-country 0.0.4 d12.aarch64 pigsty 47.7 KiB postgresql-19-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-19-pg-country 0.0.4 d13.x86_64 pigsty 47.1 KiB postgresql-19-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-19-pg-country 0.0.4 d13.aarch64 pigsty 48.0 KiB postgresql-19-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-19-pg-country 0.0.4 u22.x86_64 pigsty 54.9 KiB postgresql-19-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-19-pg-country 0.0.4 u22.aarch64 pigsty 55.9 KiB postgresql-19-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-19-pg-country 0.0.4 u24.x86_64 pigsty 51.9 KiB postgresql-19-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-19-pg-country 0.0.4 u24.aarch64 pigsty 53.2 KiB postgresql-19-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-19-pg-country 0.0.4 u26.x86_64 pigsty 50.9 KiB postgresql-19-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-19-pg-country 0.0.4 u26.aarch64 pigsty 52.0 KiB postgresql-19-pg-country_0.0.4-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_country_18 0.0.4 el8.x86_64 pigsty 50.6 KiB pg_country_18-0.0.4-1PGSTY.el8.x86_64.rpm
pg_country_18 0.0.4 el8.aarch64 pigsty 48.4 KiB pg_country_18-0.0.4-1PGSTY.el8.aarch64.rpm
pg_country_18 0.0.4 el9.x86_64 pigsty 48.2 KiB pg_country_18-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_18 0.0.4 el9.aarch64 pigsty 48.8 KiB pg_country_18-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_18 0.0.4 el10.x86_64 pigsty 48.3 KiB pg_country_18-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_18 0.0.4 el10.aarch64 pigsty 49.3 KiB pg_country_18-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-country 0.0.4 d12.x86_64 pigsty 47.4 KiB postgresql-18-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-country 0.0.4 d12.aarch64 pigsty 47.6 KiB postgresql-18-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-country 0.0.4 d13.x86_64 pigsty 47.1 KiB postgresql-18-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-18-pg-country 0.0.4 d13.aarch64 pigsty 48.0 KiB postgresql-18-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-18-pg-country 0.0.4 u22.x86_64 pigsty 54.9 KiB postgresql-18-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-18-pg-country 0.0.4 u22.aarch64 pigsty 55.9 KiB postgresql-18-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-18-pg-country 0.0.4 u24.x86_64 pigsty 51.9 KiB postgresql-18-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-18-pg-country 0.0.4 u24.aarch64 pigsty 53.2 KiB postgresql-18-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-18-pg-country 0.0.4 u26.x86_64 pigsty 50.9 KiB postgresql-18-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-18-pg-country 0.0.4 u26.aarch64 pigsty 52.0 KiB postgresql-18-pg-country_0.0.4-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_country_17 0.0.4 el8.x86_64 pigsty 50.5 KiB pg_country_17-0.0.4-1PGSTY.el8.x86_64.rpm
pg_country_17 0.0.4 el8.aarch64 pigsty 48.3 KiB pg_country_17-0.0.4-1PGSTY.el8.aarch64.rpm
pg_country_17 0.0.4 el9.x86_64 pigsty 48.2 KiB pg_country_17-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_17 0.0.4 el9.aarch64 pigsty 48.8 KiB pg_country_17-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_17 0.0.4 el10.x86_64 pigsty 48.6 KiB pg_country_17-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_17 0.0.4 el10.aarch64 pigsty 49.2 KiB pg_country_17-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-country 0.0.4 d12.x86_64 pigsty 47.1 KiB postgresql-17-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-country 0.0.4 d12.aarch64 pigsty 47.5 KiB postgresql-17-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-country 0.0.4 d13.x86_64 pigsty 47.2 KiB postgresql-17-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-17-pg-country 0.0.4 d13.aarch64 pigsty 48.3 KiB postgresql-17-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-17-pg-country 0.0.4 u22.x86_64 pigsty 56.2 KiB postgresql-17-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-17-pg-country 0.0.4 u22.aarch64 pigsty 57.2 KiB postgresql-17-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-17-pg-country 0.0.4 u24.x86_64 pigsty 51.5 KiB postgresql-17-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-17-pg-country 0.0.4 u24.aarch64 pigsty 52.8 KiB postgresql-17-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-17-pg-country 0.0.4 u26.x86_64 pigsty 50.8 KiB postgresql-17-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-17-pg-country 0.0.4 u26.aarch64 pigsty 52.0 KiB postgresql-17-pg-country_0.0.4-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_country_16 0.0.4 el8.x86_64 pigsty 50.5 KiB pg_country_16-0.0.4-1PGSTY.el8.x86_64.rpm
pg_country_16 0.0.4 el8.aarch64 pigsty 48.3 KiB pg_country_16-0.0.4-1PGSTY.el8.aarch64.rpm
pg_country_16 0.0.4 el9.x86_64 pigsty 48.2 KiB pg_country_16-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_16 0.0.4 el9.aarch64 pigsty 48.8 KiB pg_country_16-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_16 0.0.4 el10.x86_64 pigsty 48.4 KiB pg_country_16-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_16 0.0.4 el10.aarch64 pigsty 49.2 KiB pg_country_16-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-country 0.0.4 d12.x86_64 pigsty 47.3 KiB postgresql-16-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-country 0.0.4 d12.aarch64 pigsty 47.8 KiB postgresql-16-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-country 0.0.4 d13.x86_64 pigsty 47.1 KiB postgresql-16-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-16-pg-country 0.0.4 d13.aarch64 pigsty 48.1 KiB postgresql-16-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-16-pg-country 0.0.4 u22.x86_64 pigsty 56.2 KiB postgresql-16-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-16-pg-country 0.0.4 u22.aarch64 pigsty 57.2 KiB postgresql-16-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-16-pg-country 0.0.4 u24.x86_64 pigsty 51.5 KiB postgresql-16-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-16-pg-country 0.0.4 u24.aarch64 pigsty 53.2 KiB postgresql-16-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-16-pg-country 0.0.4 u26.x86_64 pigsty 50.7 KiB postgresql-16-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-16-pg-country 0.0.4 u26.aarch64 pigsty 52.0 KiB postgresql-16-pg-country_0.0.4-1PGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pg_country_15 0.0.4 el8.x86_64 pigsty 50.5 KiB pg_country_15-0.0.4-1PGSTY.el8.x86_64.rpm
pg_country_15 0.0.4 el8.aarch64 pigsty 48.3 KiB pg_country_15-0.0.4-1PGSTY.el8.aarch64.rpm
pg_country_15 0.0.4 el9.x86_64 pigsty 48.2 KiB pg_country_15-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_15 0.0.4 el9.aarch64 pigsty 48.8 KiB pg_country_15-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_15 0.0.4 el10.x86_64 pigsty 48.4 KiB pg_country_15-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_15 0.0.4 el10.aarch64 pigsty 49.2 KiB pg_country_15-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-country 0.0.4 d12.x86_64 pigsty 47.3 KiB postgresql-15-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-country 0.0.4 d12.aarch64 pigsty 49.4 KiB postgresql-15-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-country 0.0.4 d13.x86_64 pigsty 47.0 KiB postgresql-15-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-15-pg-country 0.0.4 d13.aarch64 pigsty 48.1 KiB postgresql-15-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-15-pg-country 0.0.4 u22.x86_64 pigsty 56.2 KiB postgresql-15-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-15-pg-country 0.0.4 u22.aarch64 pigsty 57.2 KiB postgresql-15-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-15-pg-country 0.0.4 u24.x86_64 pigsty 51.5 KiB postgresql-15-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-15-pg-country 0.0.4 u24.aarch64 pigsty 52.7 KiB postgresql-15-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-15-pg-country 0.0.4 u26.x86_64 pigsty 50.7 KiB postgresql-15-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-15-pg-country 0.0.4 u26.aarch64 pigsty 52.1 KiB postgresql-15-pg-country_0.0.4-1PGSTY~resolute_arm64.deb

Source

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

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

Create this extension with:

CREATE EXTENSION country;

Usage

country: ISO 3166-1 alpha-2 country code type

The country extension provides an enumerated data type for ISO 3166-1 alpha-2 country codes with minimal storage overhead.

CREATE EXTENSION country;

CREATE TABLE locations (
    id    serial PRIMARY KEY,
    code  country
);

INSERT INTO locations VALUES (1, 'US'), (2, 'GB'), (3, 'FR');

SELECT * FROM locations ORDER BY code;

Data Type

The country type restricts values to valid ISO 3166-1 alpha-2 codes (two-letter country designations like US, GB, FR, DE, etc.). Invalid codes are rejected on input.

Operators

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

Index Support

Both B-tree and hash index operator classes are provided for efficient querying and sorting on country columns.

表格阅读器