SQL Server → PostgreSQL

BIT vs BOOLEAN: Flags and Logical Columns in Migration

SQL Server BIT (0/1/NULL) becomes BOOLEAN in PostgreSQL. Watch DEFAULT, indexes, and implicit comparisons.

BIT accepts 0, 1, and NULL in SQL Server. BOOLEAN in PostgreSQL is only true/false/NULL. When migrating data, normalize values outside 0/1 before load.

DDL and data

PostgreSQL

CREATE TABLE users (
  id INT PRIMARY KEY,
  active BOOLEAN NOT NULL DEFAULT true,
  newsletter BOOLEAN
);

Analisador de Impacto

BIT columns scattered across the schema become BOOLEAN — review triggers and procedures comparing with 0 and 1.

Abrir Análise de Projeto →