MySQL → PostgreSQL
Convert MySQL FLOAT and DOUBLE to PostgreSQL
Floating-point types map directly: FLOAT to real, DOUBLE to double precision. Both follow IEEE 754, so the bits survive the trip.
FLOAT / DOUBLE → real / double precision
What to know
- FLOAT → real (4 bytes), DOUBLE → double precision (8 bytes)
- MySQL's non-standard FLOAT(M,D) display widths are dropped — they never affected storage
- NaN and Infinity are valid in PostgreSQL floats too
- For money or anything compared with =, use numeric instead
Before / after
MySQL
CREATE TABLE sensors (
reading DOUBLE
); PostgreSQL
CREATE TABLE sensors (
reading double precision
); 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.