MSSQL compatibility layer - Mailing list pgsql-general

From James Harper
Subject MSSQL compatibility layer
Date
Msg-id SYXPR01MB09278C2E9818FF9639DC6100B4190@SYXPR01MB0927.ausprd01.prod.outlook.com
Whole thread Raw
Responses Re: MSSQL compatibility layer  (Thomas Kellerer <spam_eater@gmx.net>)
List pgsql-general
Hi All,

A few years ago I got bored over summer and wrote some code to act as an MSSQL compatibility layer to postgres. Mostly
justto see if such a thing could work. The idea is that I can point the MSSQL Management Studio at the server running
postgresand it looks like I am talking to an MSSQL server. Once I got it working to a basic level I went onto other
thingsand kind of forgot about it until I was cleaning up my server a few days ago. 

Right now the code is pretty rough. I've only implemented bits and pieces to a proof of concept stage so it's
definitelyway off being useful. At the moment the following pieces are in place: 
. BackgroundWorker listening on port 1433 (hardcoded - I haven't implemented any of the udp/1434 discovery stuff)
. Parser to take TDS from an MSSQL client and make sense of it, and then take postgres results and send back to the
client
. Parser to take T-SQL statements and convert them to postgresql
. Postgres data types for MSSQL types (the main ones at least) using an internal storage format compatible with TDS

It's also not really a way for an MSSQL client to access an existing postgres database, it's more about implementing an
MSSQL-likedatabase using postgres as the backend, so an application will think it is actually talking to an MSSQL
server.I mostly don't use postgres types, just my own tds/tsql compatible types. I haven't explored what sort of
performanceimpact this might have. 

So right now you can connect, create a database, create/insert/select from some tables, etc. Stored
procedures/functionsshould be working but I just tested against 9.6 and I get some error about permission denied, and
thenwhen I tried to grant access to sa to my tsql language I got some error about "GRANT and REVOKE are not allowed on
untrustedlanguages" and haven't investigated yet. 

I'm not really sure if anyone else would find this interesting, but the code is just sitting around on my server doing
nothingat the moment. Let me know if you want to know more and I can send you a copy of the code (under GPL or whatever
license).I'm not subscribed to the list so cc me or email me direct. 

James



pgsql-general by date:

Previous
From: Alexander Farber
Date:
Subject: Re: Selecting a JSON object of arrays from a PostgreSQL table
Next
From: "Rakesh Kumar"
Date:
Subject: Re: Select for update / deadlock possibility?