SQL Server vs. PostgreSQL — Pros and Cons for the Switch

SQL Server or PostgreSQL — the question is rarely “which database is better?” but “which one fits your budget, your team and your platform?”. Whoever confuses the two questions migrates for the wrong reasons and only notices once the licensing bill shrinks while operating costs grow. Quick overview: Prerequisite: Hands-on SQL Server experience is all you … Read more

Data Migration: SQL Server to PostgreSQL — the Complete Guide

A data migration from SQL Server to PostgreSQL rarely fails at actually copying the data. It fails at the silent differences that only surface in the target: datetime, which knows no time zone, bit, which is not a boolean, an IDENTITY that turns into a sequence, and a collation that suddenly compares case-sensitively. Anyone who sets out to migrate SQL Server to PostgreSQL isn’t … Read more

Schema Migration SQL Server → PostgreSQL — Identity, Constraints, Defaults, Sequences

A SQL Server to PostgreSQL schema migration looks finished the moment the CREATE TABLE script runs without an error. That is exactly when the real trouble begins: the table is there, the data is loaded — and the first INSERT that should hand out a new ID collides with an existing key. The reason is not a typo but a change … Read more

PL/pgSQL Table-Returning Functions — RETURNS TABLE, SETOF and When a View Is Better

A view is the most elegant way to encapsulate a recurring query — right up to the moment the query needs an argument from outside. A view has no parameters. As soon as a value belongs in the WHERE that the caller supplies, the table-valued function is the tool of choice: a function that returns an entire result set … Read more

Data Type Mapping SQL Server → PostgreSQL — What Converts Cleanly and What Breaks

A migration from SQL Server to PostgreSQL rarely fails at actually copying the data. It fails at datetime, where the choice between timestamp and timestamptz is anything but cosmetic, at bit, which is not a boolean, and at money, which you’d be better off not touching in PostgreSQL at all. The SQL Server to PostgreSQL data type mapping decides whether the data arrives cleanly — … Read more