Plan to migrate from MySQL to PostgreSQL around what the tools leave behind, not only around the data copy. The result depends on which tool you pick, pgloader or AWS Database Migration Service (DMS), and on how many views, triggers, sequences and long names your schema holds.
For background on why teams switch, see PostgreSQL vs MySQL. Below you get a does-not-migrate table by tool, the 64-versus-63 identifier gap, a copy-paste pgloader load file, type casting rules and the DMS limits to put in a cutover plan.
What does not move in a MySQL to PostgreSQL migration?
Neither tool moves everything. pgloader does not migrate views or triggers, and among geometric types it covers only POINT. AWS DMS does not migrate sequences during ongoing replication, and it cannot replicate into a table with a unique index built with coalesce. You must recreate those objects by hand.
| Object | Tool | Documented limitation | Workaround |
|---|---|---|---|
| Views | pgloader | Not migrated; a full MySQL-dialect SQL parser would be needed | Recreate by hand in PostgreSQL SQL, or materialize during load |
| Triggers | pgloader | Not migrated; the difficulty has not been assessed | Port each trigger to a PostgreSQL function plus trigger |
| Geometric types other than POINT | pgloader | Only POINT is covered | Convert to PostGIS types and rewrite spatial queries |
| Sequences | AWS DMS | Not migrated to the target during ongoing replication | Update NEXTVAL for each sequence after replication stops |
| Unique index using coalesce | AWS DMS | Replication to such a table is not supported | Recreate the index as an expression index outside the task |
| Foreign key integrity in full load | AWS DMS | PostgreSQL implements foreign keys with triggers, so DMS recommends disabling them | Disable constraints, or use session_replication_role = replica for the load |
The pgloader MySQL reference lists the first three limits, and the AWS DMS PostgreSQL target page lists the rest.
How do identifier rules differ after the cutover?
MySQL allows names of 64 characters, but PostgreSQL truncates identifiers at 63 bytes by default (NAMEDATALEN 64). That one-character gap means any 64-character table, column, index or constraint name must be renamed before the load. Case rules also differ, which can break queries.
- Length - MySQL column names are limited to 64 characters, stored as UTF-8, and PostgreSQL stops at 63 bytes.
- Case in PostgreSQL - unquoted identifiers and key words fold to lower case, while quoted identifiers are case-sensitive.
- Case in MySQL - behavior depends on the platform and on lower_case_table_names. That setting defaults to 0 on Unix, 1 on Windows and 2 on macOS. You can only set it when the server is initialized.
- Index names - MySQL index names are unique per table, but PostgreSQL requires them to be unique per schema.
The PostgreSQL lexical structure page documents the folding rule. Because MySQL table names are case-sensitive on most Unix systems but not on Windows, a schema written on one platform can already be inconsistent before you start.
pgloader handles some of this for you. It downcases identifiers except PostgreSQL reserved keywords, so your application SQL must use lower case to match. It also rewrites index names with an idx_OID prefix. If you want to review how names and tables fit together first, read what a database schema is.
What does a pgloader load file look like?
A pgloader load file is a short text command. It names the MySQL source, the PostgreSQL target, the load options, the casting rules and any setup SQL. pgloader reads the MySQL metadata and builds the schema and indexes itself. This example follows the documented sakila tutorial.
LOAD DATABASE
FROM mysql://root@localhost/sakila
INTO postgresql:///sakila
WITH include drop, create tables, create indexes, reset sequences, foreign keys
CAST type datetime to timestamptz drop default drop not null using zero-dates-to-null,
type date drop not null drop default using zero-dates-to-null
MATERIALIZE VIEWS film_list, staff_list
BEFORE LOAD DO
$$ create schema if not exists sakila; $$;
Save it as sakila.load, edit the connection strings and view names, then run it.
pgloader sakila.load
Know what the defaults do before you run it. The default WITH clause is no truncate, create tables, include drop, create indexes, reset sequences, foreign keys, downcase identifiers and uniquify index names.
| Option | Cutover risk |
|---|---|
| no truncate | Existing target rows are kept, so re-runs can duplicate data |
| include drop | Uses CASCADE, so objects that reference the tables can be destroyed during a rehearsal |
| reset sequences | Sets each sequence to the current maximum of its column |
| foreign keys | Loading with constraints live can fail on out-of-order tables |
| uniquify index names | Scripts that reference the original index names break |
Which MySQL data types need casting rules?
Four things need attention: zero dates, date and time columns, auto_increment columns and ON UPDATE CURRENT_TIMESTAMP defaults. PostgreSQL rejects MySQL zero dates such as 0000-00-00, so the CAST rules above map them to null. The other changes are listed below.
| Area | MySQL 8.4 | PostgreSQL 19 | Action |
|---|---|---|---|
| Date range | DATETIME covers 0001 to 9999; TIMESTAMP covers 1970 to 2038 | timestamp covers 4713 BC to 294276 AD | Cast TIMESTAMP to timestamptz and re-check 2038 boundaries |
| Fractional seconds | Allows higher precision on temporal types | Precision p must be 0 to 6 | Round or truncate extra digits before load |
| Auto increment | auto_increment attribute | Becomes bigserial | Confirm the sequence reset after load |
| ON UPDATE CURRENT_TIMESTAMP | Column default | Becomes a before-update trigger | Re-test update paths that depend on it |
If you are also reshaping tables during the move, normalization is a separate step best done after the load is stable.
Should you use pgloader, AWS DMS or a manual load?
AWS documents DMS as the recommended tool for a heterogeneous migration such as MySQL to PostgreSQL. pgloader suits a one-command schema-and-data load with casting rules. A manual export suits small schemas where you write the DDL (the table-creation SQL) and cast rules yourself.
| Approach | Documented limit to plan for |
|---|---|
| AWS DMS | Sequences are not migrated; unique indexes with coalesce are unsupported; MaxFileSize defaults to 32,768 KB |
| pgloader | Views, triggers and most geometric types are not migrated |
| Manual scripts | pg_dump covers one database only; roles and tablespaces need pg_dumpall |
For change data capture (CDC), which copies new changes while the old database stays live, the AWS DMS MySQL source page requires binary logging with binlog_format = ROW. It also requires REPLICATION CLIENT and REPLICATION SLAVE privileges. Full-load-only tasks do not need them.
On the PostgreSQL side, the target endpoint setting MaxFileSize caps each .csv transfer file. The AWS DMS PostgreSQL target page gives a default of 32,768 KB (32 MB) and a valid range of 1 to 1,048,576 KB.
How do you rehearse the cutover?
Run the exact load file you plan to use in production against a restored copy of production, and time that run. Use the same CAST rules and BEFORE LOAD DO block. Measured time is more reliable than an estimate, and the downtime window depends on your data.
Use a throwaway database, because include drop cascades. For large tables, pgloader can read in parallel when concurrency is greater than 1, driven by a numeric primary key range. If you dump with pg_dump instead, only the directory format (-Fd) supports parallel dumps, and it exports a single database.
What are the next steps?
- List every view, trigger, sequence and spatial column in MySQL and mark who rewrites each.
- Find names of 64 characters and rename them.
- Decide pgloader or DMS, and check the CDC privileges if you need them.
- Rehearse on a copy, then reset sequences and re-test trigger paths before cutover.
Citing this guide? If you quote, summarize or build on this guide, please credit it with a link to Migrate from MySQL to PostgreSQL and What Gets Left Behind on Tutorsbot.
Photo: Pexels, Pixabay Content License, via Pixabay (https://pixabay.com/photos/coding-programming-css-1853305/)
Fazlur Rahman







