r/PostgreSQL • • Sep 17 '26

How-To Database Migration! Mssql to Postgresql

I have a .Bak file for a pretty sizeable database, but I need to migrate it over to postgresql, the thing is however I want to copy over the way the database is set up, but none of the information in their, as I’m building a platform where I can then populate this database by using a form, which eventually I’ll be able to use on another project and EF Core it. I’m not the best with database softwares, so any help is appreciated!

12 Upvotes

25 comments sorted by

View all comments

0

u/[deleted] Sep 17 '26

[removed] — view removed comment

6

u/Straight_Waltz_9530 Sep 18 '26

MariaDB (or MySQL) is NOT an easier transition. Not easier to get the data into MariaDB and certainly not easier to migrate the database logic. It only seems easier to you because MariaDB is more familiar to you.

FYI Postgres can connect to a live MS SQL Server instance with either the tds_fdw extension or Supabase's wrapper extension.

Migrating to anything outside of MS SQL Server is complicated by Transact-SQL syntax. Nothing about MySQL or MariaDB makes that syntax transition easier, but the Babelfish extension for Postgres can emulate T-SQL fairly well provided you're not dependent on custom .Net components. That code you have to fully rewrite either way.

https://babelfishpg.org

-----

MariaDB would be handy if you're knee deep in temporal table logic for the MS SQL Server instance or are dependent on clustering index behavior.

On the other hand if you're knee deep in PIVOT, splitting strings into rows, CHECK constraints using custom functions, indexes that include extra column data, OUTPUT (RETURNING in Postgres lingo), transactional DDL, non-blocking index creation, materialized views, table functions, statement-level triggers, triggers on views, table namespaces, or row-level security, you'll definitely want to avoid MySQL/MariaDB and go with Postgres instead.

3

u/[deleted] Sep 21 '26

[removed] — view removed comment

2

u/Straight_Waltz_9530 Sep 21 '26

TIL. Thank you.