babelfishpg_money
babelfishpg_money
babelfish : SQL Server Money Data Type
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 9330 | babelfishpg_money
|
babelfish
|
1.1.0 |
SIM
|
Apache-2.0
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-dt-
|
No
|
Yes
|
No
|
Yes
|
no
|
yes
|
| Relationships | |
|---|---|
| See Also | babelfishpg_common
babelfishpg_tsql
babelfishpg_tds
financial
tds_fdw
numeral
orafce
pgtt
|
| Siblings | babelfishpg_common
babelfishpg_tsql
babelfishpg_tds
|
special case: this extension only works on wiltondb kernel fork
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
1.1.0 |
18
17
16
15
14
|
babelfish |
- |
| RPM | PIGSTY
|
1.1.0 |
18
17
16
15
14
|
babelfish_$v |
babelfishpg_$v, antlr4-runtime413 |
| DEB | PIGSTY
|
1.1.0 |
18
17
16
15
14
|
babelfishpg-$v-babelfish |
babelfishpg-$v, libantlr4-runtime413 |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
el8.aarch64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
el9.x86_64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
el9.aarch64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
el10.x86_64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
el10.aarch64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
d12.x86_64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
d12.aarch64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
d13.x86_64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
d13.aarch64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
u22.x86_64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
u22.aarch64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
u24.x86_64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
u24.aarch64
|
MISS
|
PIGSTY 5.5.0
|
MISS
|
MISS
|
MISS
|
Source
pig build pkg babelfish; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install babelfish; # install via package name, for the active PG version
pig install babelfishpg_money; # install by extension name, for the current active PG version
pig install babelfishpg_money -v 17; # install for PG 17Create this extension with:
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
Last updated on