babelfishpg_tsql

SQL Server Transact SQL compatibility

Overview

PackageVersionCategoryLicenseLanguage
babelfish5.4.0SIMApache-2.0C
IDExtensionBinLibLoadCreateTrustRelocSchema
9300babelfishpg_commonNoYesNoYesNoYes-
9310babelfishpg_tsqlNoYesNoYesNoYes-
9320babelfishpg_tdsNoYesYesYesNoYes-
9330babelfishpg_moneyNoYesNoYesYesNo-
Relatedbabelfishpg_common uuid-ossp babelfishpg_money pg_hint_plan tds_fdw session_variable orafce pgtt db_migrator
Depended Bybabelfishpg_tds

special case: this extension only works on wiltondb kernel fork

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY5.4.01817161514babelfishbabelfishpg_common, uuid-ossp
RPMPIGSTY6.0.01817161514babelfish-$vantlr4-runtime413
DEBPIGSTY6.0.01817161514babelfish-$vlibantlr4-runtime413
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
el8.aarch64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
el9.x86_64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
el9.aarch64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
el10.x86_64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
el10.aarch64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
d12.x86_64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
d12.aarch64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
d13.x86_64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
d13.aarch64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
u22.x86_64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
u22.aarch64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
u24.x86_64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
u24.aarch64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
u26.x86_64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A
u26.aarch64PIGSTY 6.0.0PIGSTY 5.4.0N/AN/AN/A

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 18  # PG 18
pig ext install -y babelfish -v 17  # PG 17
dnf install -y babelfish-18       # PG 18
dnf install -y babelfish-17       # PG 17
apt install -y babelfish-18   # PG 18
apt install -y babelfish-17   # PG 17

Create Extension:

CREATE EXTENSION babelfishpg_tsql CASCADE;  -- requires: babelfishpg_common, uuid-ossp

Usage

Sources:

babelfishpg_tsql implements the T-SQL language and SQL Server-compatible catalog behavior used by Babelfish. It is one component of a Babelfish database, not a compatibility layer that can be added to stock PostgreSQL by itself: the complete stack requires the Babelfish-patched PostgreSQL engine plus the common, TDS, and T-SQL extensions.

Core Workflow

Configure the TDS protocol extension for preload and restart the Babelfish server:

shared_preload_libraries = 'babelfishpg_tds'

Create the TDS extension with CASCADE so its extension dependencies, including babelfishpg_tsql, are installed. Choose the migration mode before initialization.

CREATE EXTENSION IF NOT EXISTS babelfishpg_tds CASCADE;

ALTER SYSTEM SET babelfishpg_tsql.database_name = 'babelfish_db';
ALTER SYSTEM SET babelfishpg_tsql.migration_mode = 'multi-db';

CALL sys.initialize_babelfish('babelfish_user');

After configuration is reloaded as directed by the installation guide, SQL Server clients connect to the TDS listener, commonly on port 1433, and issue T-SQL in the logical databases created by Babelfish.

Component and Object Index

  • babelfishpg_tsql supplies the T-SQL parser, procedural language, system objects, compatibility functions, and T-SQL configuration variables.
  • babelfishpg_tds supplies the Tabular Data Stream listener and is the normal installation entry point.
  • babelfishpg_common supplies shared data types and functions. It and uuid-ossp are declared dependencies of babelfishpg_tsql.
  • babelfishpg_money supplies money-related compatibility objects used by the stack.
  • sys.initialize_babelfish(login_name) provisions the Babelfish catalogs and initial login.
  • sys.sp_babelfish_configure controls documented compatibility escape hatches.
  • babelfishpg_tsql.database_name identifies the physical PostgreSQL database hosting Babelfish.
  • babelfishpg_tsql.migration_mode selects single-db or multi-db logical-database mapping.

Operational Boundaries

Installation requires superuser privileges and a Babelfish build matched to the extension release. Do not install babelfishpg_tsql alone and expect TDS connectivity. The migration mode is a provisioning decision and is not intended to be changed after the database is initialized.

Babelfish implements a substantial but incomplete SQL Server surface. Validate application syntax, data types, system-catalog assumptions, drivers, and escape-hatch settings against the official limitations before migration. PostgreSQL and T-SQL connections can observe different naming and transaction semantics.

The catalog change from 5.5.0 to 5.4.0 is a version correction to the official BABEL_5_4_0 release line, not evidence of a new feature or an automatic downgrade procedure.


Last Modified 2026-07-23: update extension list to 555 (d81fc56)