Abstract
This publication discloses, enables, and dates a mechanism by which application code written against a Microsoft SQL Server (T-SQL) client driver is executed unchanged against a PostgreSQL server by an in-process driver facade that transpiles each SQL statement to PostgreSQL dialect at query time, inside the application process, with zero additional infrastructure. The facade reproduces the driver's object model — the pool, the request object with fluent input().query(), the { recordset, rowsAffected } result shape, and the named-parameter binding convention — so that the swap is invisible to callers. The transpiler performs, per statement: MERGE→INSERT … ON CONFLICT with source-alias expression resolution (source columns resolve to real parameters in the VALUES list and to EXCLUDED references in the SET list); OUTPUT INSERTED→RETURNING relocation; repair of a mis-placed mid-statement RETURNING clause; TOP→LIMIT deferral; DATEADD/DATEDIFF/CONVERT/ISNULL function mapping; a bracket-and-camelCase identifier quoting pass; a T-SQL→PostgreSQL type map; and longest-first named-parameter substitution with null-parameter IS-NULL rewriting. A distinct contribution is that idempotency error tolerance is gated on statement class: an "already exists"/"does not exist" error is swallowed only for CREATE/ALTER/DROP data-definition statements, never for data-manipulation, closing a real silent-data-failure defect. The whole transpiler is a pure function unit-tested without a database. The design is published to bar exclusionary patenting of the mechanism.
Creative Commons License

This work is licensed under a Creative Commons Attribution 4.0 License.
Recommended Citation
Assuncao, gustavo matthew, "In-Process Live T-SQL-to-PostgreSQL Transpiling Driver Facade with DDL/DML-Differentiated Idempotency Tolerance and Tri-Backend App Namespacing", Technical Disclosure Commons, ()
https://www.tdcommons.org/dpubs_series/10962