Skip to main content

SQL Server (Babelfish)

Babelfish for PostgreSQL provides SQL Server wire-protocol compatibility, letting you connect SQL Server clients and run T-SQL queries without modifying your application.

Connecting

Two ports are available:

PortProtocolClient
1433TDS (SQL Server wire)SQL Server drivers, SSMS, sqlcmd
5432PostgreSQLpsql, JDBC, all PostgreSQL clients

SQL Server clients

# sqlcmd
sqlcmd -S HOST,1433 -U USER -P PASS -Q "SELECT @@VERSION"

# Connection string (.NET / ADO.NET)
Server=HOST,1433;Database=defaultdb;User Id=USER;Password=PASS;Encrypt=true;TrustServerCertificate=false;

# JDBC (SQL Server driver)
jdbc:sqlserver://HOST:1433;databaseName=defaultdb;user=USER;password=PASS;encrypt=true;

PostgreSQL clients

PGPASSWORD=PASS psql "host=HOST user=USER dbname=defaultdb sslmode=verify-full"

T-SQL Compatibility

Babelfish supports a large subset of T-SQL syntax including:

  • SELECT, INSERT, UPDATE, DELETE, MERGE
  • Stored procedures (CREATE PROCEDURE)
  • Functions (CREATE FUNCTION)
  • Triggers (CREATE TRIGGER)
  • SQL Server data types (NVARCHAR, DATETIME, UNIQUEIDENTIFIER, BIT, etc.)
  • sys. catalog views (partial emulation)
  • INFORMATION_SCHEMA views
  • SET options (NOCOUNT, ANSI_NULLS, etc.)

Known Limitations

Not all SQL Server features are supported. Common gaps:

FeatureStatus
SQL Server Agent jobsNot supported
Linked serversNot supported
CLR integrationNot supported
Full-text searchNot supported
OPENROWSET / OPENDATASOURCENot supported
Distributed transactions (MSDTC)Not supported
Change Data Capture (CDC)Not supported
FOR XML clausesLimited support
Spatial data typesLimited support

For the full compatibility matrix, see the Babelfish documentation.

Database Users

Create a user with SQL Server-compatible credentials:

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/database-users \
-H "Content-Type: application/json" \
-d '{"username": "app_user", "role": "admin"}'

Configuration

Babelfish runs on top of PostgreSQL. PostgreSQL-level tuning applies:

curl -u admin:password -X PATCH \
https://api.foundrydb.com/managed-services/{id}/configuration \
-H "Content-Type: application/json" \
-d '{
"parameters": {
"max_connections": "200",
"shared_buffers": "2GB"
}
}'

Backups

Backups use pgBackRest on the underlying PostgreSQL instance. PITR is available to any second within the retention window:

curl -u admin:password -X POST \
https://api.foundrydb.com/managed-services/{id}/backups/restore \
-H "Content-Type: application/json" \
-d '{"restore_point": "2026-03-15T14:30:00Z", "target_service_name": "restored-mssql"}'