PostgreSQL → MySQL data type mapping
How our converter maps each PostgreSQL type when generating MySQL 8 SQL. Lossy mappings are explicit — they are flagged in every conversion report instead of failing silently.
| PostgreSQL type | MySQL type | Notes |
|---|---|---|
| smallint / integer / bigint | SMALLINT / INT / BIGINT | |
| serial / identity | AUTO_INCREMENT | counter continues from the right value |
| numeric(p,s) | DECIMAL(p,s) | clamped to MySQL's max DECIMAL(65,30) |
| real / double precision | FLOAT / DOUBLE | |
| varchar(n) | VARCHAR(n) | very long varchars become LONGTEXT |
| text | LONGTEXT | |
| boolean | TINYINT(1) | true/false become 1/0 |
| timestamp | DATETIME(6) | microsecond precision preserved |
| timestamptz | DATETIME(6) | values converted to UTC (MySQL stores no zone) |
| date / time | DATE / TIME(6) | |
| interval | VARCHAR(255) | MySQL has no interval type; stored as text |
| uuid | CHAR(36) | gen_random_uuid() default becomes (uuid()) |
| json / jsonb | JSON | |
| arrays (text[], int[]…) | JSON | kept queryable via MySQL JSON functions |
| enum types | ENUM('a','b') | labels preserved |
| bytea | LONGBLOB | |
| inet / cidr / macaddr | VARCHAR | stored as text |
| bit(n) | BIT(n) | |
| tsvector / hstore / ranges | LONGTEXT / VARCHAR | no MySQL equivalent; stored as text with a warning |
| views | — (commented out) | definitions included as comments for manual porting |
Ready to migrate? Convert your PostgreSQL dump now — free up to 10 MB, validated on a real MySQL server.