babelfishpg_tsql
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
babelfish | 5.5.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 uuid-ossp babelfishpg_money pg_hint_plan tds_fdw session_variable orafce pgtt db_migrator |
|---|---|
| Depended By | babelfishpg_tds |
special case: this extension only works on wiltondb kernel fork
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 5.5.0 | 1817161514 | babelfish | babelfishpg_common, uuid-ossp |
| RPM | PIGSTY | 5.5.0 | 1817161514 | babelfish_$v | babelfishpg_$v, antlr4-runtime413 |
| DEB | PIGSTY | 5.5.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_tsql CASCADE; -- requires: babelfishpg_common, uuid-ossp
Usage
The babelfishpg_tsql extension provides Microsoft SQL Server Transact-SQL (T-SQL) compatibility for PostgreSQL as part of the Babelfish project. Applications written for SQL Server can connect and run queries against PostgreSQL with minimal changes.
Enabling
CREATE EXTENSION babelfishpg_tsql;
Key Features
- T-SQL Language Support: Understands T-SQL syntax including stored procedures, functions, triggers, and batches
- SQL Server Wire Protocol: Applications can connect using the TDS (Tabular Data Stream) protocol on port 1433
- System Procedures: Common
sp_system stored procedures are available - System Views: SQL Server catalog views (e.g.,
sys.tables,sys.columns,sys.objects) - Multi-Database Semantics: Supports SQL Server-style database/schema separation
Supported T-SQL Features
BEGIN...ENDblocks,IF...ELSE,WHILEloopsTRY...CATCHerror handling- Temporary tables (
#temp,##global_temp) - Table variables (
DECLARE @t TABLE (...)) IDENTITYcolumns and@@IDENTITY/SCOPE_IDENTITY()TOPclause,OUTPUTclauseMERGEstatements- Common Table Expressions (CTEs)
- Cross-database queries within the same instance
EXEC/EXECUTEfor dynamic SQL- SQL Server-style string concatenation and NULL handling
PRINTandRAISERRORstatements
Connecting via TDS Protocol
Applications can connect using SQL Server drivers (JDBC, ODBC, ADO.NET) to the TDS listener port (default 1433):
Server: hostname
Port: 1433
Database: mydb
Notes
- Requires
babelfishpg_commonextension - Part of the Babelfish for PostgreSQL project (Apache 2.0 / PostgreSQL license)
- Not all T-SQL features are supported; check the Babelfish compatibility reference
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.