pg_money
精确的带币种金额类型、算术与金额分摊
仓库
RustedBytes/pg-money
https://github.com/RustedBytes/pg-money
源码
pg_money-0.3.0.tar.gz
pg_money-0.3.0.tar.gz
概览
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 3690 | pg_money | 否 | 是 | 否 | 是 | 否 | 是 | - |
Currency metadata is built in; the currency extension is related, not required.
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.3.0 | 1817161514 | pg_money | - |
| RPM | PIGSTY | 0.3.0 | 1817161514 | pg_money_$v | - |
| DEB | PIGSTY | 0.3.0 | 1817161514 | postgresql-$v-pg-money | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.3.0 el8.x86_64.pg18 : pg_money_18 pg_money_18-0.3.0-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.3.0 el8.x86_64.pg17 : pg_money_17 pg_money_17-0.3.0-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.3.0 el8.x86_64.pg16 : pg_money_16 pg_money_16-0.3.0-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.3.0 el8.x86_64.pg15 : pg_money_15 pg_money_15-0.3.0-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.3.0 el8.x86_64.pg14 : pg_money_14 pg_money_14-0.3.0-1PGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 0.3.0 el8.aarch64.pg18 : pg_money_18 pg_money_18-0.3.0-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.3.0 el8.aarch64.pg17 : pg_money_17 pg_money_17-0.3.0-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.3.0 el8.aarch64.pg16 : pg_money_16 pg_money_16-0.3.0-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.3.0 el8.aarch64.pg15 : pg_money_15 pg_money_15-0.3.0-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.3.0 el8.aarch64.pg14 : pg_money_14 pg_money_14-0.3.0-1PGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 0.3.0 el9.x86_64.pg18 : pg_money_18 pg_money_18-0.3.0-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.3.0 el9.x86_64.pg17 : pg_money_17 pg_money_17-0.3.0-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.3.0 el9.x86_64.pg16 : pg_money_16 pg_money_16-0.3.0-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.3.0 el9.x86_64.pg15 : pg_money_15 pg_money_15-0.3.0-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.3.0 el9.x86_64.pg14 : pg_money_14 pg_money_14-0.3.0-1PGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 0.3.0 el9.aarch64.pg18 : pg_money_18 pg_money_18-0.3.0-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.3.0 el9.aarch64.pg17 : pg_money_17 pg_money_17-0.3.0-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.3.0 el9.aarch64.pg16 : pg_money_16 pg_money_16-0.3.0-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.3.0 el9.aarch64.pg15 : pg_money_15 pg_money_15-0.3.0-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.3.0 el9.aarch64.pg14 : pg_money_14 pg_money_14-0.3.0-1PGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 0.3.0 el10.x86_64.pg18 : pg_money_18 pg_money_18-0.3.0-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.3.0 el10.x86_64.pg17 : pg_money_17 pg_money_17-0.3.0-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.3.0 el10.x86_64.pg16 : pg_money_16 pg_money_16-0.3.0-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.3.0 el10.x86_64.pg15 : pg_money_15 pg_money_15-0.3.0-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.3.0 el10.x86_64.pg14 : pg_money_14 pg_money_14-0.3.0-1PGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 0.3.0 el10.aarch64.pg18 : pg_money_18 pg_money_18-0.3.0-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.3.0 el10.aarch64.pg17 : pg_money_17 pg_money_17-0.3.0-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.3.0 el10.aarch64.pg16 : pg_money_16 pg_money_16-0.3.0-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.3.0 el10.aarch64.pg15 : pg_money_15 pg_money_15-0.3.0-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.3.0 el10.aarch64.pg14 : pg_money_14 pg_money_14-0.3.0-1PGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 0.3.0 d12.x86_64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.3.0 d12.x86_64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.3.0 d12.x86_64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.3.0 d12.x86_64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.3.0 d12.x86_64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 0.3.0 d12.aarch64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.3.0 d12.aarch64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.3.0 d12.aarch64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.3.0 d12.aarch64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.3.0 d12.aarch64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 0.3.0 d13.x86_64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~trixie_amd64.deb
| PIGSTY 0.3.0 d13.x86_64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~trixie_amd64.deb
| PIGSTY 0.3.0 d13.x86_64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~trixie_amd64.deb
| PIGSTY 0.3.0 d13.x86_64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~trixie_amd64.deb
| PIGSTY 0.3.0 d13.x86_64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 0.3.0 d13.aarch64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~trixie_arm64.deb
| PIGSTY 0.3.0 d13.aarch64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~trixie_arm64.deb
| PIGSTY 0.3.0 d13.aarch64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~trixie_arm64.deb
| PIGSTY 0.3.0 d13.aarch64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~trixie_arm64.deb
| PIGSTY 0.3.0 d13.aarch64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 0.3.0 u22.x86_64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~jammy_amd64.deb
| PIGSTY 0.3.0 u22.x86_64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~jammy_amd64.deb
| PIGSTY 0.3.0 u22.x86_64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~jammy_amd64.deb
| PIGSTY 0.3.0 u22.x86_64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~jammy_amd64.deb
| PIGSTY 0.3.0 u22.x86_64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 0.3.0 u22.aarch64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~jammy_arm64.deb
| PIGSTY 0.3.0 u22.aarch64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~jammy_arm64.deb
| PIGSTY 0.3.0 u22.aarch64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~jammy_arm64.deb
| PIGSTY 0.3.0 u22.aarch64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~jammy_arm64.deb
| PIGSTY 0.3.0 u22.aarch64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 0.3.0 u24.x86_64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~noble_amd64.deb
| PIGSTY 0.3.0 u24.x86_64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~noble_amd64.deb
| PIGSTY 0.3.0 u24.x86_64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~noble_amd64.deb
| PIGSTY 0.3.0 u24.x86_64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~noble_amd64.deb
| PIGSTY 0.3.0 u24.x86_64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 0.3.0 u24.aarch64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~noble_arm64.deb
| PIGSTY 0.3.0 u24.aarch64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~noble_arm64.deb
| PIGSTY 0.3.0 u24.aarch64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~noble_arm64.deb
| PIGSTY 0.3.0 u24.aarch64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~noble_arm64.deb
| PIGSTY 0.3.0 u24.aarch64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 0.3.0 u26.x86_64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~resolute_amd64.deb
| PIGSTY 0.3.0 u26.x86_64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~resolute_amd64.deb
| PIGSTY 0.3.0 u26.x86_64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~resolute_amd64.deb
| PIGSTY 0.3.0 u26.x86_64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~resolute_amd64.deb
| PIGSTY 0.3.0 u26.x86_64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 0.3.0 u26.aarch64.pg18 : postgresql-18-pg-money postgresql-18-pg-money_0.3.0-1PGSTY~resolute_arm64.deb
| PIGSTY 0.3.0 u26.aarch64.pg17 : postgresql-17-pg-money postgresql-17-pg-money_0.3.0-1PGSTY~resolute_arm64.deb
| PIGSTY 0.3.0 u26.aarch64.pg16 : postgresql-16-pg-money postgresql-16-pg-money_0.3.0-1PGSTY~resolute_arm64.deb
| PIGSTY 0.3.0 u26.aarch64.pg15 : postgresql-15-pg-money postgresql-15-pg-money_0.3.0-1PGSTY~resolute_arm64.deb
| PIGSTY 0.3.0 u26.aarch64.pg14 : postgresql-14-pg-money postgresql-14-pg-money_0.3.0-1PGSTY~resolute_arm64.deb
|
构建
您可以使用 pig build 命令构建 pg_money 扩展的 RPM / DEB 包:
安装
您可以直接安装 pg_money 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
使用 pig 或者是 apt/yum/dnf 安装扩展:
安装
pig
dnf
apt
创建扩展:
用法
来源:
pg_money 在 PostgreSQL 14–18 中提供精确的带币种金额、算术、舍入与分摊功能,其类型独立于受区域设置影响的内置金额类型。
核心工作流
对象与语义
money_with_currency 将币种与精确十进制金额一起存储,money_minor 处理最小货币单位金额。money_make、money_from_minor 和 money_minor_make 用于构造值。money_round 接受明确的舍入模式,money_split 在保持总额不变的前提下分配余数。
算术和聚合会拒绝不兼容币种,不会隐式兑换。汇率须显式提供,或由 money_exchange_at 从应用管理的表中读取;扩展不获取市场行情。应在应用边界检查舍入和金额范围。
运行
0.3.0 控制文件要求超级用户安装,并允许重定位,无需预加载。应将汇率表和修改权限与只读算术区分管理;SQL 输入本身不能证明汇率正确或及时。
这个页面对您有帮助吗?
感谢反馈,我们会据此改进这篇文档。
哪里没有解决?(可选)