MSSQL To PostgreSQL
MSSQL support uses sys.* catalog introspection and a small set of SQL Server-specific conversions that are worth understanding up front.
Start here
Section titled “Start here”MSSQL-specific decisions
Section titled “MSSQL-specific decisions”- choose the right
source_schemainstead of relying on thedbodefault blindly - decide whether
datetime_as_timestamptzshould be enabled - keep
money_as_numeric = trueunless you explicitly want text preservation - enable
single_txonly if snapshot isolation is available on the source database
Common caveats
Section titled “Common caveats”timestampandrowversionare binary values, not datetimesdatetime2andtimefractional precision fromsys.columns.scaleis mapped to PostgreSQLtimestamp(n)/timestamptz(n)/time(n)with n clamped to 6 (SQL Server’s maximum scale 7 becomes 6 on PostgreSQL)uniqueidentifiervalues are reordered to standard UUID byte order during copy- computed columns are materialized as values and reported for manual semantic follow-up
- Non–B-tree indexes (columnstore, hash, XML, spatial) and filtered (predicate) indexes are skipped with warnings; only clustered/nonclustered B-tree shapes are recreated on PostgreSQL
- External tables (
sys.tables.is_external) are excluded from migration by default; semantic warnings list each skipped name - System-versioned temporal tables produce semantic warnings: current rows copy as a flat table;
SYSTEM_TIME, history-table semantics, and retention are not recreated - Sequence-style defaults (
NEXT VALUE FOR …) are not translated to PostgreSQL; defaults are omitted and semantic warnings point you at sequences + hooks or manual DDL sql_variantcolumns are selected withTRY_CAST(… AS nvarchar(max))to avoid hard failures on some bases; values may become NULL or lose fidelity—see semantic warnings
Operational caveats
Section titled “Operational caveats”- Always Encrypted / column encryption: pgferry does not configure keys or
column encryption setting. Depending on the driver and server policy, encrypted columns may error or return unusable values. Use a DSN and client settings that match your SQL Server deployment (see Microsoft’s driver documentation). - Synonyms: Introspection follows real objects in
source_schema.sys.synonymstargets are not expanded; point the DSN/schema at underlying tables or use hooks. - Cross-schema foreign keys: When a FK references another schema, pgferry logs a warning at introspection. The FK may fail in PostgreSQL if the referenced table is not in the target schema; adjust migration order, use hooks, or align schemas.
- Azure SQL / connectivity: Firewalls, TLS, and
encrypt/ trust settings are environment-specific; the config wizard validates DSN shape viamsdsnbut does not cover every hosting matrix.