MySQL → PostgreSQL
Convert MySQL VARCHAR to PostgreSQL varchar
VARCHAR looks identical in both engines, but the units differ in spirit: both count characters, yet MySQL's row-size limits and index prefix rules disappear in PostgreSQL.
VARCHAR(n) → varchar(n)
What to know
- VARCHAR(n) → varchar(n) — values and lengths carry over unchanged
- PostgreSQL has no 65,535-byte row limit, so very wide tables import fine
- Indexes need no (191) prefix hacks — full-column indexes always work
- utf8mb4 columns become plain UTF-8 text; collation differences can affect ORDER BY of mixed-language data
Before / after
MySQL
CREATE TABLE users (
email VARCHAR(255) NOT NULL UNIQUE
) CHARSET=utf8mb4; PostgreSQL
CREATE TABLE users (
email varchar(255) NOT NULL UNIQUE
); Don't convert column-by-column — convert the whole database.
Upload a dump, get back ready-to-import SQL with this mapping (and every other one) applied.
Open the MySQL → PostgreSQL converterSee the full type mapping table or all guides.