babelfishpg_money
SQL Server Money Data Type
Repository
https://babelfishpg.org/
https://babelfishpg.org/
Source
babelfishpg-17.8-5.5.0.tar.gz
babelfishpg-17.8-5.5.0.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
babelfish | 1.1.0 | SIM | Apache-2.0 | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 9300 | babelfishpg_common | No | Yes | No | Yes | No | Yes | - |
| 9310 | babelfishpg_tsql | No | Yes | No | Yes | No | Yes | - |
| 9320 | babelfishpg_tds | No | Yes | Yes | Yes | No | Yes | - |
| 9330 | babelfishpg_money | No | Yes | No | Yes | Yes | No | - |
| Related | babelfishpg_common babelfishpg_tsql babelfishpg_tds financial tds_fdw numeral orafce pgtt |
|---|
special case: this extension only works on wiltondb kernel fork
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1.0 | 1817161514 | babelfish | - |
| RPM | PIGSTY | 1.1.0 | 1817161514 | babelfish_$v | babelfishpg_$v, antlr4-runtime413 |
| DEB | PIGSTY | 1.1.0 | 1817161514 | babelfishpg-$v-babelfish | babelfishpg-$v, libantlr4-runtime413 |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| el8.aarch64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| el9.x86_64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| el9.aarch64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| el10.x86_64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| el10.aarch64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| d12.x86_64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| d12.aarch64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| d13.x86_64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| d13.aarch64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| u22.x86_64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| u22.aarch64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| u24.x86_64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| u24.aarch64 | PIGSTY MISS | PIGSTY 5.5.0 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
Build
You can build the RPM / DEB packages for babelfish using pig build:
pig build pkg babelfish # build RPM / DEB packages
Install
You can install babelfish directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install babelfish; # Install for current active PG version
pig ext install -y babelfish -v 17 # PG 17
dnf install -y babelfish_17 # PG 17
apt install -y babelfishpg-17-babelfish # PG 17
Create Extension:
CREATE EXTENSION babelfishpg_money;
Usage
The babelfishpg_money extension provides SQL Server-compatible MONEY and SMALLMONEY data type implementations for PostgreSQL as part of the Babelfish project.
Enabling
CREATE EXTENSION babelfishpg_money;
Data Types
- MONEY - 8-byte monetary value ranging from -922,337,203,685,477.5808 to 922,337,203,685,477.5807, with fixed 4 decimal places
- SMALLMONEY - 4-byte monetary value ranging from -214,748.3648 to 214,748.3647, with fixed 4 decimal places
Behavior
The extension implements SQL Server’s monetary arithmetic rules:
- Fixed-point representation with exactly 4 decimal digits
- SQL Server-compatible rounding behavior for monetary calculations
- Proper casting between MONEY and other numeric types
- Arithmetic operations follow SQL Server semantics (e.g., money / money = money, not float)
Notes
- Part of the Babelfish for PostgreSQL project
- Works in conjunction with
babelfishpg_commonwhich provides the base type infrastructure - The PostgreSQL built-in
moneytype has different precision and behavior; this extension provides the SQL Server-compatible variant
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.