Skip to content

babelfishpg_tsql

SQL Server Transact SQL compatibility

babelfish · SQL Server Transact SQL compatibility

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
9310babelfishpg_tsqlbabelfish6.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 15babelfishbabelfishpg_common, uuid-ossp
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_tsql;		# install by extension name

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

Create this extension with:

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.

Table reader