Amazon Opens the Code for Babelfish, Extensions to Replace MS SQL Server with PostgreSQL

Share on Facebook Share on Twitter Pinterest LinkedIn Tumblr

Amazon has opened the original texts of the draft ” Babelfish for PostgreSQL “, proposing an extension to the PostgreSQL database with the implementation of specific capabilities database Microsoft SQL Server. The key goal of the project is to provide the ability to run applications written for SQL Server on servers running PostgreSQL. The project code is open under Apache 2.0 and PostgreSQL License.

Babelfish supports the network protocol used to connect clients to SQL Server, the T-SQL language and SQL Server-specific query language extensions, which allows you to translate running applications from Microsoft SQL Server to PostgreSQL without modifying their code or with minimal changes and without replacing drivers to the DBMS … For applications, Babelfish looks like a regular SQL Server. The project is already in use on Amazon Aurora.

The Babelfish project is stated to follow an open development model that allows community contributors to make changes and influence development progress. For users, switching to Babelfish will allow them to avoid significant royalties for using SQL Server, bypass license restrictions and not depend on changes in the maintenance policy of a proprietary product (cancellation of benefits, termination of platform support, price increases).

The project includes a set of PostgreSQL extensions , a set of PostgreSQL patches and a compass toolkit :

  • Extensions provide PostgreSQL with support for additional syntax, data types, and functionality required to migrate from SQL Server. A total of 4 extensions are proposed:
    • babelfishpg_tsql is an implementation of the T-SQL (Transact-SQL) language that augments SQL with procedural programming, local variable support, and advanced functions for handling strings, dates, and math expressions. Most of the requested T-SQL features have been implemented, including savepoints, stored procedures, and nested transactions. Nevertheless, a significant part of the syntax and functions remains unimplemented (as a rule, these are features rarely used in real applications, a compatibility table ). For example, the constructions “ADD SIGNATURE”, “CREATE AGGREGATE”, “CREATE / ALTER / DROP APPLICATION ROLE | ASSEMBLY | ASYMMETRIC KEY”, “BEGIN CONVERSATION TIME”, “END / MOVE CONVERSATION”, etc. are not yet available.
    • babelfishpg_tds is an implementation of the TDS (Tabular Data Stream) protocol used in SQL Server for networking between the DBMS and the client. TDS protocol version 7.1 and higher is supported.
    • babelfishpg_common is an implementation of SQL Server-specific data types.
    • babelfishpg_money is a money type implementation based on the FixedDecimal extension code .
  • The patches include changes to the PostgreSQL engine required to provide additional functionality in Babelfish extensions. Currently, together with the PostgreSQL developers, work is underway to include the prepared patches into the main composition of PostgreSQL. Patches prepared for PostgreSQL 13 .
  • The compass utility is designed to analyze T-SQL DDL scripts and SQL code for compatibility with Babelfish. At the output, a report is generated which functionality required to launch the application is not yet supported in Babelfish.

The following client libraries for connecting to MS SQL Server are officially supported:

  • Ado.NET Entity framework
  • SQL Server Native Client 11.0
  • ODBC (Open Database Connectivity)
  • JDBC (Java Database Connectivity)

Write A Comment