跳转到主要内容

country

国家代码数据类型,遵循ISO 3166-1标准

pg_country · 国家代码数据类型,遵循ISO 3166-1标准

概览

ID扩展软件包版本类别许可证编程语言
3660countrypg_country0.0.4TYPEPostgreSQLC
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--s-d-r否是否是是否

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY0.0.419 18 17 16 15pg_country-
RPMPIGSTY0.0.419 18 17 16 15pg_country_$v-
DEBPIGSTY0.0.419 18 17 16 15postgresql-$v-pg-country-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
el8.aarch64N/APIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
el9.x86_64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
el9.aarch64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
el10.x86_64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
el10.aarch64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
d12.x86_64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
d12.aarch64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
d13.x86_64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
d13.aarch64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
u22.x86_64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
u22.aarch64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
u24.x86_64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
u24.aarch64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
u26.x86_64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
u26.aarch64PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4PIGSTY 0.0.4
软件包版本平台仓库大小下载
pg_country_190.0.4el9.x86_64pigsty48.7 KiBpg_country_19-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_190.0.4el9.aarch64pigsty49.5 KiBpg_country_19-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_190.0.4el10.x86_64pigsty48.4 KiBpg_country_19-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_190.0.4el10.aarch64pigsty49.3 KiBpg_country_19-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-19-pg-country0.0.4d12.x86_64pigsty47.5 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-19-pg-country0.0.4d12.aarch64pigsty47.7 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-19-pg-country0.0.4d13.x86_64pigsty47.1 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-19-pg-country0.0.4d13.aarch64pigsty48.0 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-19-pg-country0.0.4u22.x86_64pigsty54.9 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-19-pg-country0.0.4u22.aarch64pigsty55.9 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-19-pg-country0.0.4u24.x86_64pigsty51.9 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-19-pg-country0.0.4u24.aarch64pigsty53.2 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-19-pg-country0.0.4u26.x86_64pigsty50.9 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-19-pg-country0.0.4u26.aarch64pigsty52.0 KiBpostgresql-19-pg-country_0.0.4-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_country_180.0.4el8.x86_64pigsty50.6 KiBpg_country_18-0.0.4-1PGSTY.el8.x86_64.rpm
pg_country_180.0.4el8.aarch64pigsty49.0 KiBpg_country_18-0.0.4-1PGSTY.el8.aarch64.rpm
pg_country_180.0.4el9.x86_64pigsty48.6 KiBpg_country_18-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_180.0.4el9.aarch64pigsty49.5 KiBpg_country_18-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_180.0.4el10.x86_64pigsty48.4 KiBpg_country_18-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_180.0.4el10.aarch64pigsty49.3 KiBpg_country_18-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-country0.0.4d12.x86_64pigsty47.3 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-country0.0.4d12.aarch64pigsty47.6 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-country0.0.4d13.x86_64pigsty47.1 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-18-pg-country0.0.4d13.aarch64pigsty48.0 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-18-pg-country0.0.4u22.x86_64pigsty54.9 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-18-pg-country0.0.4u22.aarch64pigsty55.9 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-18-pg-country0.0.4u24.x86_64pigsty51.9 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-18-pg-country0.0.4u24.aarch64pigsty53.2 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-18-pg-country0.0.4u26.x86_64pigsty50.9 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-18-pg-country0.0.4u26.aarch64pigsty52.0 KiBpostgresql-18-pg-country_0.0.4-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_country_170.0.4el8.x86_64pigsty50.6 KiBpg_country_17-0.0.4-1PGSTY.el8.x86_64.rpm
pg_country_170.0.4el8.aarch64pigsty48.9 KiBpg_country_17-0.0.4-1PGSTY.el8.aarch64.rpm
pg_country_170.0.4el9.x86_64pigsty48.7 KiBpg_country_17-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_170.0.4el9.aarch64pigsty49.7 KiBpg_country_17-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_170.0.4el10.x86_64pigsty48.4 KiBpg_country_17-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_170.0.4el10.aarch64pigsty49.2 KiBpg_country_17-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-country0.0.4d12.x86_64pigsty47.2 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-country0.0.4d12.aarch64pigsty47.5 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-country0.0.4d13.x86_64pigsty47.2 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-17-pg-country0.0.4d13.aarch64pigsty48.3 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-17-pg-country0.0.4u22.x86_64pigsty56.2 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-17-pg-country0.0.4u22.aarch64pigsty57.2 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-17-pg-country0.0.4u24.x86_64pigsty51.5 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-17-pg-country0.0.4u24.aarch64pigsty52.8 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-17-pg-country0.0.4u26.x86_64pigsty50.8 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-17-pg-country0.0.4u26.aarch64pigsty52.0 KiBpostgresql-17-pg-country_0.0.4-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_country_160.0.4el8.x86_64pigsty50.6 KiBpg_country_16-0.0.4-1PGSTY.el8.x86_64.rpm
pg_country_160.0.4el8.aarch64pigsty48.9 KiBpg_country_16-0.0.4-1PGSTY.el8.aarch64.rpm
pg_country_160.0.4el9.x86_64pigsty48.7 KiBpg_country_16-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_160.0.4el9.aarch64pigsty49.7 KiBpg_country_16-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_160.0.4el10.x86_64pigsty48.6 KiBpg_country_16-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_160.0.4el10.aarch64pigsty49.2 KiBpg_country_16-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-country0.0.4d12.x86_64pigsty47.3 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-country0.0.4d12.aarch64pigsty47.8 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-country0.0.4d13.x86_64pigsty47.1 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-16-pg-country0.0.4d13.aarch64pigsty48.0 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-16-pg-country0.0.4u22.x86_64pigsty56.2 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-16-pg-country0.0.4u22.aarch64pigsty57.2 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-16-pg-country0.0.4u24.x86_64pigsty51.5 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-16-pg-country0.0.4u24.aarch64pigsty52.8 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-16-pg-country0.0.4u26.x86_64pigsty50.7 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-16-pg-country0.0.4u26.aarch64pigsty52.0 KiBpostgresql-16-pg-country_0.0.4-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
pg_country_150.0.4el8.x86_64pigsty50.5 KiBpg_country_15-0.0.4-1PGSTY.el8.x86_64.rpm
pg_country_150.0.4el8.aarch64pigsty48.9 KiBpg_country_15-0.0.4-1PGSTY.el8.aarch64.rpm
pg_country_150.0.4el9.x86_64pigsty48.7 KiBpg_country_15-0.0.4-1PGSTY.el9.x86_64.rpm
pg_country_150.0.4el9.aarch64pigsty49.7 KiBpg_country_15-0.0.4-1PGSTY.el9.aarch64.rpm
pg_country_150.0.4el10.x86_64pigsty48.6 KiBpg_country_15-0.0.4-1PGSTY.el10.x86_64.rpm
pg_country_150.0.4el10.aarch64pigsty49.2 KiBpg_country_15-0.0.4-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-country0.0.4d12.x86_64pigsty47.3 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-country0.0.4d12.aarch64pigsty47.7 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-country0.0.4d13.x86_64pigsty47.0 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~trixie_amd64.deb
postgresql-15-pg-country0.0.4d13.aarch64pigsty48.1 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~trixie_arm64.deb
postgresql-15-pg-country0.0.4u22.x86_64pigsty56.2 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~jammy_amd64.deb
postgresql-15-pg-country0.0.4u22.aarch64pigsty57.2 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~jammy_arm64.deb
postgresql-15-pg-country0.0.4u24.x86_64pigsty51.5 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~noble_amd64.deb
postgresql-15-pg-country0.0.4u24.aarch64pigsty52.7 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~noble_arm64.deb
postgresql-15-pg-country0.0.4u26.x86_64pigsty50.8 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~resolute_amd64.deb
postgresql-15-pg-country0.0.4u26.aarch64pigsty52.1 KiBpostgresql-15-pg-country_0.0.4-1PGSTY~resolute_arm64.deb

源码

pig build pkg pg_country;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install pg_country;		# install by package name
pig install country;		# install by extension name

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 EXTENSION country;

用法

country: ISO 3166-1 alpha-2 国家代码类型

country 扩展提供了一个枚举数据类型,用于表示 ISO 3166-1 alpha-2 国家代码,存储开销极低。

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;

数据类型

country 类型将值限制为有效的 ISO 3166-1 alpha-2 代码(两字母国家代码,如 US、GB、FR、DE 等)。无效代码在输入时会被拒绝。

运算符

支持标准比较运算符:=、<>、<、>、<=、>=。

索引支持

提供 B-tree 和 Hash 索引运算符类,可在 country 列上进行高效查询和排序。

表格阅读器