Database modernization · Blog

SQL Server to PostgreSQL migration: a practical checklist

Moving off SQL Server is rarely hard because of the data. It's hard because of everything that quietly depends on it. Here's the checklist I use to keep a migration predictable.

Amol BansalSolution ArchitectSeptember 2026

Why teams move to PostgreSQL

The usual drivers are licensing cost, the wish to run the same database on any cloud or on-premise, and PostgreSQL's mature feature set: strong standards compliance, JSONB, full-text search, rich indexing and a large extension ecosystem. None of that matters, though, if the migration breaks reports, integrations or month-end jobs. So the work starts with an inventory, not with a data copy.

1. Assess before you move anything

2. Map the data types

Most types translate cleanly, but a few cause subtle bugs if you map them on autopilot.

SQL ServerPostgreSQLWatch out for
INT IDENTITYINT GENERATED … AS IDENTITYReset sequences to MAX(id)+1 after loading
NVARCHAR(n) / VARCHAR(MAX)VARCHAR(n) / TEXTPostgreSQL is UTF-8 throughout; check collation and case sensitivity
DATETIME / DATETIME2TIMESTAMPDecide deliberately between TIMESTAMP and TIMESTAMPTZ
BITBOOLEANApplication code comparing to 0/1
UNIQUEIDENTIFIERUUIDDefault generation: gen_random_uuid()
MONEYNUMERIC(19,4)Avoid PostgreSQL's money type; it depends on locale
VARBINARY(MAX)BYTEALarge binaries may belong in object storage instead

One more trap: SQL Server's default collation is usually case-insensitive, while PostgreSQL compares text case-sensitively. Queries like WHERE email = 'A@x.com' can silently return nothing. Use citext, a case-insensitive collation, or lower-cased indexes where it matters.

3. Convert the code, not just the schema

T-SQL stored procedures have to be rewritten in PL/pgSQL. Tools such as AWS Schema Conversion Tool, pgloader or Babelfish can speed up the mechanical part, but plan for manual review of:

4. Move the data and prove it arrived

5. Test what the business actually uses

Unit tests rarely catch migration issues. Replay real workloads: the top reports, the slowest queries, month-end jobs and every integration. Compare results between old and new side by side, and compare query plans for anything that got slower. PostgreSQL's planner is different, and indexes that were perfect on SQL Server may need rethinking.

6. Plan the cut-over like a release

The short version

  1. Inventory objects and consumers
  2. Map types deliberately, especially collation and timestamps
  3. Rewrite T-SQL with review, not blind conversion
  4. Load, then prove the data with counts, hashes and business checks
  5. Replay real workloads and compare results
  6. Cut over with a rehearsed runbook and rollback

Done this way, a SQL Server to PostgreSQL migration becomes a planned engineering project instead of a risky weekend. If you are planning one, see how I run SQL Server to PostgreSQL migrations.

Planning a migration or rollout?

Tell me what you're working with. A 30-minute conversation is usually enough to map the risks and a realistic plan.

WhatsAppLinkedIn