pgTSQL: Sybase & SQL Server Compatibility

Postgres is better than SQL Server, has great comparative benchmarks, and used used by Microsoft Skype to scale to 1 billion users.

"Developers are more likely to port SQL Server to Postgres because it is open source, supports more ANSI features, runs on more platforms, uses a different ACID model and has a great optimizer. "   Joe Celko, Author of SQL For Smarties

"New Features" of SQL Server that have been in PostgreSQL for years

pgTSQL is Compatible with T-SQL

T-SQL is the procedural programming language that is the next step in the History of Sybase & SQL Server.

The pgTSQL extension is available for installation through Postgres by BigSQL. First install the tds_fdw using BigSQL Manager or the PGC command line:

  ./pgc install pgtsql9-pg95

Then activate it, with the CREATE EXTENSION command, in the database you wish to use it in.

  CREATE EXTENSION pgtsql;
Now lets create a sample table in PostgreSQL and insert a few rows.

CREATE TABLE rdbms_supports_tsql (
  organization  varchar(10) primary key
);
INSERT INTO rdbms_supports_tsql VALUES ('SYBASE');
INSERT INTO rdbms_supports_tsql VALUES ('SQL-SERVER');
INSERT INTO rdbms_supports_tsql VALUES ('POSTGRESQL BY BIGSQL');
Now we create a T-SQL compatible function in PostgreSQL and we are free from proprietary vendor lock-in!!

CREATE OR REPLACE FUNCTION query_tsql_rdbms() RETURNS void AS $$
  DECLARE @val int = 0
BEGIN
  SELECT count(*) INTO @val FROM rdbms_supports_tsql;
  IF @val = 2
    PRINT 'Proprietary market featuring vendor lock-in'
  ELSE
    PRINT 'Open Source innovation means choices'
END
$$ LANGUAGE pltsql;

Development Roadmap

Join our open Development Community.