MySQL → PostgreSQL
Convert MySQL TEXT types to PostgreSQL text
MySQL has four TEXT sizes because of storage internals. PostgreSQL needs just one: text has no length limit and no performance penalty versus varchar.
TINYTEXT … LONGTEXT → text
What to know
- TINYTEXT, TEXT, MEDIUMTEXT and LONGTEXT all map to text
- No size limits to re-check after migration — text holds up to ~1 GB per value
- Indexes on long text columns work without prefix lengths (unlike MySQL)
- Character set headaches disappear: PostgreSQL databases are UTF-8 end to end
Before / after
MySQL
CREATE TABLE posts (
body MEDIUMTEXT,
KEY idx_body (body(191))
); PostgreSQL
CREATE TABLE posts (
body text
);
CREATE INDEX idx_body ON posts (body); 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.