SwapSQL

Migration errors

Fix: ERROR 1118 — Row size too large when creating tables

ERROR 1118 (42000): Row size too large. The maximum row size for the used table type … is 65535.

When it happens

Creating MySQL tables with many VARCHAR columns — often after converting a PostgreSQL schema with wide text columns.

Why it happens

MySQL limits a row (excluding TEXT/BLOB) to 65,535 bytes. With utf8mb4, VARCHAR(n) reserves up to 4n bytes, so a few VARCHAR(4096) columns already blow the limit.

How to fix it

1. Move wide columns to TEXT

ALTER TABLE t MODIFY long_field TEXT;

TEXT/BLOB columns count only ~12 bytes toward the row limit.

2. Audit the widest columns

SELECT column_name, character_maximum_length
FROM information_schema.columns
WHERE table_name='t' ORDER BY 2 DESC;

3. Converting from PostgreSQL with us?

Long varchars are widened to LONGTEXT automatically, so generated schemas stay under the row-size limit.

Migrating between MySQL and PostgreSQL?

Our converter handles this and dozens of other gotchas automatically — upload a dump, download working SQL.

Try the converter free

More: all migration guides & error fixes