// Migrate SQL Server to PostgreSQL
Migrate SQL Server to PostgreSQL: plan, convert, cut over, then support
To migrate SQL Server to PostgreSQL, OSSeva assesses each application, converts the schema and rewrites the T-SQL in PL/pgSQL, moves the data with pgloader or comparable tooling, runs old and new side by side, cuts over with a rollback plan and then supports the PostgreSQL cluster 24/7 on infrastructure you control. How long it takes depends on your schema size, T-SQL volume, the number of clients that connect and the downtime window you can accept, so the assessment sets the dates. OSSeva does not support SQL Server itself; a 15-minute discovery call starts the written assessment.
- The plan
- Assess each application, convert schema and T-SQL, run in parallel, cut over; then support
- SQL Server dates (endoflife.date)
- 2016: out of support since 14 Jul 2026, ESUs to 17 Jul 2029. 2017: 12 Oct 2027. 2019: 8 Jan 2030
- Tools
- pgloader for schema and data; Babelfish Compass to assess T-SQL; AWS DMS Schema Conversion for Aurora and RDS targets
- What sets the timeline
- Schema size, T-SQL volume, number of connecting clients and the downtime window you can accept
- Patch window
- Critical CVEs (CVSS 9.0 or higher) within 48 hours, High within 7 days
- Support hours
- Assure includes 24/7 reactive support; Operate adds managed operations and a 15-minute P1 response
Dates checked on endoflife.date on 20 October 2026. Tool behaviour from the pgloader, Babelfish, Babelfish Compass and AWS DMS Schema Conversion documentation and the PostgreSQL 18 manual, all fetched on 20 October 2026.
Trusted globally by enterprises





How to convert SQL Server to PostgreSQL: the T-SQL checklist
pgloader moves tables, data, indexes and keys, and its documentation also describes loading views as tables. It does not describe converting stored procedures, functions or triggers, so that code is rewritten and tested. This checklist lists the T-SQL constructs we check first and the PostgreSQL route for each. It names risk areas, not a promise that each one occurs in your estate; the assessment finds which do.
| T-SQL construct | PostgreSQL route | Manual work and what to check |
|---|---|---|
| Stored procedures that return result sets | Functions with RETURNS TABLE or SETOF, or cursors | Every caller changes: drivers, ORMs, SSIS packages and reports that read a procedure's result set. |
| TRY...CATCH, THROW, RAISERROR | EXCEPTION blocks and RAISE | A caught exception in PL/pgSQL rolls back everything since the block's BEGIN. Error numbers and severities do not map, so client code that tests them changes. |
| BEGIN TRAN, COMMIT, ROLLBACK and @@TRANCOUNT in procedures | Procedures run with CALL can end a transaction; functions cannot | Nested transaction counting has no equivalent. Batch loops that commit every N rows become procedures, or move into the application. |
| IDENTITY, SCOPE_IDENTITY(), @@IDENTITY | Identity columns and INSERT ... RETURNING | Replace each SCOPE_IDENTITY() call with RETURNING, and reset the sequences to the loaded maximum after the data load. |
| OUTPUT clause, UPDATE ... FROM, DELETE ... FROM | RETURNING, UPDATE ... FROM, DELETE ... USING | The syntax differs in every statement. The PostgreSQL 18 documentation describes returning both old and new row values. |
| MERGE | MERGE (PostgreSQL 15 and later) | Test it under concurrent load before relying on it. |
| CROSS APPLY and OUTER APPLY | LATERAL joins | A direct rewrite; compare row counts on both sides. |
| Temporary tables (#temp, ##global) and table variables | CREATE TEMP TABLE, arrays or CTEs | PostgreSQL requires each session to create its own temporary table, and GLOBAL makes no difference, so ##global tables are redesigned. Table variables become temporary tables or CTEs. |
| Cursors and WHILE loops over rows | Set-based SQL, FOR loops or PL/pgSQL cursors | Rewrite to set-based SQL where the logic allows, and test the rest row for row. |
| Dynamic SQL: sp_executesql, EXEC(@sql) | EXECUTE with format(), quote_ident and quote_literal | Review each statement for injection: the PostgreSQL manual notes that EXECUTE does not work reliably without quote_literal and quote_ident. |
| Case-insensitive collations | Nondeterministic ICU collations, the citext extension or lower() indexes | SQL Server databases are often case-insensitive and PostgreSQL's default collations are case-sensitive. Choose per column, then recheck unique constraints, joins and LIKE queries. |
| DATETIME, DATETIME2, BIT, UNIQUEIDENTIFIER, MONEY, NVARCHAR | timestamp or timestamptz, boolean, uuid, numeric, text or varchar | pgloader's default casts map datetime and datetime2 to timestamptz, bit to boolean, uniqueidentifier to uuid, money to numeric, and char, varchar and nvarchar to text. A datetime column has no time zone, so decide whether timestamptz is right before the load. |
| Schemas such as dbo | A PostgreSQL schema, or public | pgloader can rename dbo to public in the load command. Decide the schema layout before scripts and permissions are converted. |
| WITH (NOLOCK) and READ UNCOMMITTED | Remove the hint; PostgreSQL's multiversion concurrency control | PostgreSQL's Read Uncommitted mode behaves like Read Committed, so dirty reads are not available. Check the reports that used NOLOCK for changed results. |
| Linked servers and OPENQUERY | Foreign data wrappers | Inventory every linked server and the queries that cross it; each needs a tested path. |
| SQL Server Agent jobs, SSIS packages, SSRS reports | pg_cron or an external scheduler; packages and reports re-pointed or rebuilt | These are not database objects, so only the connection inventory finds them. Each needs a tested path before cutover. |
| CLR assemblies, Service Broker, temporal tables, full-text catalogs | No direct equivalent | Redesigned in the application or with extensions. The Babelfish differences page also lists CLR, Service Broker and temporal tables as unsupported. |
Sources fetched 20 October 2026: the pgloader 3.6.10 documentation (MS SQL to Postgres); the PostgreSQL 18 documentation (Porting from Oracle PL/SQL for exception handling, EXECUTE and per-session state, transaction management, CREATE TABLE, MERGE, RETURNING, LATERAL, collation support, transaction isolation); the pg_cron README; and the Babelfish page on differences from SQL Server, which says its list is subject to change.
SQL Server to PostgreSQL migration: tools, T-SQL differences and data types →SQL Server to PostgreSQL with pgloader →
Why move off SQL Server
Three reasons start most SQL Server exits. Whether a move pays depends on your own core count, edition and licence terms, so this page states no figure; the database support cost calculator works from the numbers you enter.
Every SQL Server version has an end date
SQL Server 2016 reached end of support on 14 July 2026. 2017 follows on 12 October 2027 and 2019 on 8 January 2030 (endoflife.date, checked 20 October 2026). Staying means an upgrade or, for 2016, Extended Security Updates as a bridge. Leaving is the third option.
Staying is a licence decision as well
An upgrade or Extended Security Updates are purchases from Microsoft. PostgreSQL is released under the PostgreSQL License, a liberal open source licence with no per-core fee, so the question becomes what the migration takes.
Applications you control can choose their database
If you own the application code, the database is a choice. If a vendor certifies its product only on SQL Server, that application usually stays. The assessment gives a plain verdict per database: migrate, defer or stay.
The dates that matter
2026-07-14
SQL Server 2016 reaches end of support. Extended Security Updates run to 17 July 2029.
2027-10-12
SQL Server 2017 reaches end of support.
2029-11-08
PostgreSQL 17 reaches community end of life.
2030-01-08
SQL Server 2019 reaches end of support. Mainstream support ended on 28 February 2025.
2030-11-14
PostgreSQL 18 reaches community end of life.
The phased plan to migrate SQL Server to PostgreSQL
1. Assess and choose a path
An inventory of databases, T-SQL objects and every client that connects. For each application we recommend native PostgreSQL or Babelfish and say why. Babelfish Compass, the project's compatibility assessment tool, analyzes T-SQL scripts for the Babelfish side.
2. Convert schema and T-SQL, and migrate the data
pgloader discovers the SQL Server schema, including indexes and primary and foreign keys, and builds it in PostgreSQL. T-SQL procedures and functions are rewritten in PL/pgSQL and reviewed. Loads are rehearsed with row counts and checksums compared on both sides, and casting rules written down for the columns that need them.
3. Run in parallel
Applications, reports and scheduled jobs run against PostgreSQL alongside SQL Server until the results match.
4. Cut over
A cutover runbook with a final sync, go and no-go checks and a rollback plan, run with your team in the change window. The cluster moves into support the same day.
Native PostgreSQL or Babelfish: how to choose per application
There are two honest ways off SQL Server. You can convert the schema and T-SQL to native PostgreSQL, which is what OSSeva migrates and supports. Or you can keep much of the T-SQL and run it through Babelfish, which lets PostgreSQL understand SQL Server's wire protocol and T-SQL. Babelfish for Aurora PostgreSQL is AWS's managed form of it, and for that route AWS is the right partner.
Run Babelfish Compass on your T-SQL scripts before deciding. It is the Babelfish project's compatibility assessment tool, and the result tells you how much of an application would run unchanged.
Two paths off SQL Server
| Path | What you get | Limits | Who supports it |
|---|---|---|---|
| Native PostgreSQL | Standard PostgreSQL with the schema converted, the T-SQL rewritten in PL/pgSQL and clients pointed at PostgreSQL drivers. | The most code and client work. | OSSeva migrates and supports it. |
| Babelfish | PostgreSQL that accepts SQL Server clients on the TDS protocol and much of the T-SQL, so applications connect with fewer code changes. | Supports a subset of T-SQL: its documentation lists unsupported features and says the list is subject to change. Its four extensions depend on patches to community PostgreSQL, so it is a different engine to operate. | AWS for Babelfish for Aurora PostgreSQL. Self-managed Babelfish is not part of OSSeva support. |
From babelfishpg.org, the babelfish_extensions README, the Babelfish page on differences from SQL Server and the Aurora User Guide page on Babelfish, fetched 20 October 2026.
Which tool does which job
No tool converts everything. Schema and data move mostly by machine; the T-SQL, and the clients that call it, are where the hours go.
Migration tools for SQL Server to PostgreSQL
| Tool | What it does | What it leaves to you |
|---|---|---|
| pgloader | Loads SQL Server data into PostgreSQL with automatic schema discovery, including indexes and primary and foreign keys. Casting rules are configurable, and views can be loaded as tables. Open source under the PostgreSQL Licence. | Stored procedures, functions and triggers: its MS SQL documentation describes none, so plan to rewrite them. |
| Ora2Pg | Lists SQL Server migration among its features, using the unixODBC package and the DBD::ODBC Perl driver. Free software under GPL v3 or later. | Its README documents PL/SQL conversion rather than T-SQL, so review any generated code. |
| AWS DMS Schema Conversion | Converts SQL Server schemas to Aurora PostgreSQL or RDS for PostgreSQL with a rules-based engine, adds generative AI conversion on this path, and produces an assessment report of what converts and what needs manual work. | The data: it converts the schema, not the data, and its targets are Aurora and RDS only. |
| Babelfish Compass | Analyzes T-SQL DDL and SQL scripts for compatibility with Babelfish. | Conversion: it is an assessment tool for the Babelfish path. |
From the pgloader 3.6.10 documentation, the Ora2Pg README, the AWS DMS Schema Conversion user guide and the Babelfish Compass README, fetched 20 October 2026.
Support after cutover
The new cluster moves into OSSeva support on the day of cutover, wherever it runs: your servers, VMs, Kubernetes or cloud account. The team that moved your data is the team that answers the pager, and Assure includes 24/7 reactive support.
Support tiers for the PostgreSQL cluster you land on
| Tier | What it adds | Response and patch terms |
|---|---|---|
| Patch | Signed PostgreSQL builds with backported security fixes once your major version passes community end of life (17 on 8 November 2029, 18 on 14 November 2030). | Critical CVEs (CVSS 9.0 or higher) patched within 48 hours, High within 7 days. |
| Assure | Everything in Patch, plus major-version migration planning, a performance and vacuum configuration audit, a compliance attestation package and 24/7 reactive support. | 24/7 reactive support. |
| Operate | Everything in Assure, plus managed operations: replication and failover monitoring, Patroni, repmgr and quorum monitoring, vacuum and analyze tuning, point-in-time recovery testing and quarterly capacity reviews. | 15-minute P1 incident response. |
Tier contents from the OSSeva PostgreSQL technology page. Support is priced per cluster; the discovery call gives the quote. PostgreSQL end-of-life dates from endoflife.date, checked 20 October 2026.
Does OSSeva support SQL Server itself?
No. This is a migration-out service. We assess your SQL Server estate, convert it, move the data and then support the PostgreSQL you land on. We do not patch, tune or support SQL Server, and we do not advise on Microsoft licensing. For an in-place upgrade or Extended Security Updates, Microsoft and its partners are the right route.
How do the ways of moving off SQL Server compare?
| Option | What you get | Trade-off |
|---|---|---|
| Stay on SQL Server | No code changes: upgrade in place, or buy Extended Security Updates for 2016 as a bridge | Licensing and the upgrade cycle stay as they are. Microsoft and its partners are the right partner. |
| Babelfish for Aurora PostgreSQL | T-SQL and SQL Server clients on a managed AWS service, with few code changes for many applications | The database lives on Aurora, and unsupported T-SQL still has to be rewritten. |
| Aurora or RDS for PostgreSQL | A hosted target, with AWS DMS Schema Conversion for the schema and code | The database stays on that provider's service and support calendar. |
| Do it yourself with open-source tools | Full control, using pgloader and your own team | Your team carries the T-SQL rewrite, the cutover and the PostgreSQL operations afterwards. |
| OSSeva migration and support | Native PostgreSQL on your own infrastructure, migrated and then supported by one team | A services engagement followed by a subscription, priced per cluster. Self-managed Babelfish is not part of OSSeva support. |
Tool behaviour from the pgloader 3.6.10 MS SQL reference, the Babelfish, Babelfish Compass and AWS DMS Schema Conversion documentation, the Ora2Pg README and the PostgreSQL 18 manual, fetched on 20 October 2026. SQL Server and PostgreSQL dates from endoflife.date, checked on 20 October 2026. OSSeva coverage from the OSSeva PostgreSQL technology page. Savings depend on your own estate; the calculator uses your inputs and no assumed figures.
SQL Server 2016 is out of support: move to PostgreSQL or pay again?
SQL Server 2016 reached end of support on 14 July 2026, and Microsoft's Extended Security Updates run to 17 July 2029 as a paid bridge. Paying again means an upgrade or ESUs. Moving to PostgreSQL is worth assessing when you own the application code, because the cost of the move is set by your T-SQL and your clients rather than by a licence. We give no figure; the calculator uses your own numbers.
When is SQL Server 2019 end of life?
SQL Server 2019 left mainstream support on 28 February 2025, and its extended support ends on 8 January 2030 (endoflife.date, checked 20 October 2026). SQL Server 2017 ends on 12 October 2027.
How do I convert SQL Server to PostgreSQL?
In three parts. Schema and data move with a tool such as pgloader or AWS DMS Schema Conversion. The T-SQL stored procedures, functions and triggers are rewritten in PL/pgSQL, using a checklist like the one on this page. The clients, reports and jobs that connect are re-pointed and tested. The first part is mechanical; the second and third set the pace.
Which tool should I use to migrate SQL Server to PostgreSQL?
For data and schema, pgloader is free and open source, and it discovers the SQL Server schema including indexes and keys. For T-SQL code, no tool converts everything, so plan for review and rewriting. If you want to keep most of the T-SQL, look at Babelfish. On AWS, DMS Schema Conversion handles SQL Server to Aurora or RDS for PostgreSQL.
How do I migrate MSSQL to Postgres using pgloader?
Point pgloader at the SQL Server source and the PostgreSQL target in a load command, add casting rules for any types that need them, and run it. It creates the tables, loads the data and builds indexes and primary and foreign keys. Its documentation describes no conversion of stored procedures, so convert them separately.
Is there a free SQL Server to PostgreSQL migration tool?
Yes. pgloader is open source and loads SQL Server data into PostgreSQL with automatic schema discovery. Babelfish is also open source, under the Apache 2.0 and PostgreSQL licences, and Babelfish Compass is its free assessment tool.
What is Babelfish for PostgreSQL?
An open-source project that lets PostgreSQL understand SQL Server's wire protocol and T-SQL, so applications written for SQL Server can connect with fewer changes. It supports a subset of T-SQL, and its four extensions depend on patches to community PostgreSQL. AWS offers it as a managed feature of Aurora PostgreSQL.
Can we migrate SQL Server to Aurora PostgreSQL instead?
Yes. Babelfish for Aurora PostgreSQL and DMS Schema Conversion both target AWS's managed service, which is a good choice if you want to stay on AWS-managed databases. OSSeva's offer is for teams that want community PostgreSQL on infrastructure they control.
What decides how long a SQL Server to PostgreSQL migration takes?
Schema size, the volume of T-SQL in stored procedures and triggers, the number of clients, SSIS packages and reports that connect, and the downtime window you can accept. We do not quote a duration in advance; the assessment turns those inputs into a plan, and the plan carries the dates.
What are the main challenges?
T-SQL procedures that need rewriting, differences in case sensitivity, identity columns and temporary tables, and the number of clients, reports and jobs that connect to SQL Server directly. The checklist near the top of this page lists the constructs we check first.
Does OSSeva provide SQL Server support?
No. This is a migration-out service. We help you leave SQL Server and support the PostgreSQL you land on, and we do not patch, tune or support SQL Server itself.
Who is this for?
Teams moving SQL Server databases behind their own applications to PostgreSQL they run themselves, who want the migration and the support afterwards from one team.
Get a quote
Migrate SQL Server to PostgreSQL on a path that fits each application.
Book a 15-minute discovery call. The written assessment follows, and support is priced per cluster.
Prefer to talk or read more first?