跳转到主要内容

edtf_postgres

EDTF 日期校验、规范化、边界计算与时态关系

概览

扩展包名版本分类许可证语言
edtf_postgres1.2.3TIMEMIT OR Apache-2.0Rust
ID扩展名BinLibLoadCreateTrustReloc模式
1130edtf_postgres否是否是是是-

Trusted extension; upstream Cargo requests pgrx 0.19.1 and the locked build uses 0.19.2.

版本

类型仓库版本PG 大版本包名依赖
EXTPIGSTY1.2.31817161514edtf_postgres-
RPMPIGSTY1.2.31817161514edtf_postgres_$v-
DEBPIGSTY1.2.31817161514postgresql-$v-edtf-postgres-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el8.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el9.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el9.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el10.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
el10.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
d12.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
d12.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
d13.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
d13.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u22.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u22.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u24.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u24.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u26.x86_64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
u26.aarch64
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3
PIGSTY 1.2.3

构建

您可以使用 pig build 命令构建 edtf_postgres 扩展的 RPM / DEB 包:

pig build pkg edtf_postgres         # 构建 RPM / DEB 包

安装

您可以直接安装 edtf_postgres 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:

pig repo add pgsql -u          # 添加仓库并更新缓存

使用 pig 或者是 apt/yum/dnf 安装扩展:

安装
pig install edtf_postgres;          # 当前活跃 PG 版本安装
pig
pig ext install -y edtf_postgres -v 18  # PG 18
pig ext install -y edtf_postgres -v 17  # PG 17
pig ext install -y edtf_postgres -v 16  # PG 16
pig ext install -y edtf_postgres -v 15  # PG 15
pig ext install -y edtf_postgres -v 14  # PG 14
dnf
dnf install -y edtf_postgres_18       # PG 18
dnf install -y edtf_postgres_17       # PG 17
dnf install -y edtf_postgres_16       # PG 16
dnf install -y edtf_postgres_15       # PG 15
dnf install -y edtf_postgres_14       # PG 14
apt
apt install -y postgresql-18-edtf-postgres   # PG 18
apt install -y postgresql-17-edtf-postgres   # PG 17
apt install -y postgresql-16-edtf-postgres   # PG 16
apt install -y postgresql-15-edtf-postgres   # PG 15
apt install -y postgresql-14-edtf-postgres   # PG 14

创建扩展:

CREATE EXTENSION edtf_postgres;

用法

来源:

edtf_postgres 为 ISO 8601-2:2019 Annex A 字符串提供 Extended Date/Time Format 校验、规范化、边界计算与时间关系判断。

启用

1.2.3 版本为 amd64 与 arm64 上的 PostgreSQL 14–18 发布构件。安装匹配构件后执行:

CREATE EXTENSION edtf_postgres;

扩展可迁移且为 trusted,因此拥有数据库 CREATE 权限的角色可以安装。它不要求预加载。

校验与规范形式

接收外部文本前使用 edtf_valid,用 edtf_level 查看支持的 EDTF 级别,并用 edtf_canonical 统一等价表示。

SELECT edtf_valid('1985-04-12');
SELECT edtf_level('1985-04-12/..');
SELECT edtf_canonical('1985-04-12');

edtf_min 与 edtf_max 返回便于索引的日期边界。edtf_relation 比较两个表达式并返回三值时间关系。

SELECT edtf_min('1985-04'), edtf_max('1985-04');
SELECT edtf_relation('1985', '1986');

数据建模边界

扩展处理文本与派生日期;它不会代替应用校验,也不会引入持久化 EDTF 基础类型。若不确定性与限定符很重要,应保留原始表达式;只有在查询语义明确时才为派生边界建立索引。

这个页面对您有帮助吗?