Skip to content

babelfishpg_common

SQL Server Transact SQL Datatype Support

babelfish · SQL Server Transact SQL Datatype Support

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
9300babelfishpg_commonbabelfish6.2.0SIMApache-2.0C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d-rNoYesNoYesyesno
Babelfish kernel: PG17.11/5.7.0, PG18.6/6.2.0; packages follow PG18.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY6.2.019 18 17 16 15babelfish-
RPMPIGSTY6.2.019 18 17 16 15babelfish-$vantlr4-runtime413
DEBPIGSTY6.2.019 18 17 16 15babelfish-$vlibantlr4-runtime413
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
el8.aarch64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
el9.x86_64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
el9.aarch64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
el10.x86_64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
el10.aarch64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
d12.x86_64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
d12.aarch64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
d13.x86_64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
d13.aarch64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
u22.x86_64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
u22.aarch64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
u24.x86_64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
u24.aarch64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
u26.x86_64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A
u26.aarch64N/APIGSTY 6.2.0PIGSTY 5.7.0N/AN/A

Source

pig build pkg babelfish;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

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

Install this extension with pig:

pig install babelfish;		# install by package name
pig install babelfishpg_common;		# install by extension name

pig install babelfishpg_common -v 18;   # install for PG 18
pig install babelfishpg_common -v 17;   # install for PG 17

Create this extension with:

CREATE EXTENSION babelfishpg_common;

Usage

babelfishpg_common: SQL Server Transact SQL Datatype Support

The babelfishpg_common extension provides SQL Server-compatible data type support for PostgreSQL as part of the Babelfish project. It enables PostgreSQL to understand and work with Microsoft SQL Server data types.

Enabling

CREATE EXTENSION babelfishpg_common;

SQL Server Data Types

The extension adds the following SQL Server-compatible data types:

  • TINYINT - 1-byte unsigned integer (0 to 255)
  • SMALLMONEY - Small monetary value
  • MONEY - Monetary value (see also babelfishpg_money)
  • DATETIME - SQL Server-style datetime
  • DATETIME2 - Extended precision datetime
  • SMALLDATETIME - Reduced precision datetime
  • DATETIMEOFFSET - Date and time with timezone offset
  • BIT - SQL Server-compatible boolean
  • NCHAR / NVARCHAR - Unicode character types
  • UNIQUEIDENTIFIER - SQL Server-style UUID
  • VARBINARY - Variable-length binary data
  • IMAGE - Legacy binary data type
  • SQL_VARIANT - Generic data type container
  • XML - SQL Server-compatible XML type
  • SYSNAME - System name type (nvarchar(128))

Key Features

  • Provides implicit and explicit type casting between SQL Server and PostgreSQL types
  • Supports SQL Server-style collation behavior
  • Handles SQL Server-specific type coercion rules
  • Works in conjunction with babelfishpg_tsql for full T-SQL compatibility

This extension is typically deployed as part of a full Babelfish for PostgreSQL installation and is a prerequisite for babelfishpg_tsql.

Table reader