Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Lossless FLOAT dump (historical document)

Fabio Erculiani edited this page Apr 24, 2015 · 1 revision

Introduction

Math is hard. Floating point math is even harder.

Alas, MySQL has changed things in MySQL 5.0 that make lossless conversions impossible. See Bug36829 for details. This will not be fixed until 5.1.

Details

To use this feature, invoke mysqldump with the --lossless-fp option. When this is used, columns with type float and double are converted to a decimal string with 17 digits of precision. This is done because conversions from double to decimal and then back to double are lossless (the initial double value is equal to the final double value) when the double to decimal conversion generates 17 digits of precision. This is generally true. There are some values for float and double for which this is not true (subnormal).

mysqldump --lossless-fp my_database my_table > my_table.dump