Make text-to-double conversion exact in PostgreSQL backend.
By setting extra_float_digits to its maximal value (instead of the default 0) we can ensure that the conversion from text (which we use when saving the values in the database) to double (used internally) and back (when we retrieve the values) is lossless and so that we read back exactly the same values as we had written. In principle, the best solution would be to use binary format with PQexecParams() instead: this would avoid the conversion to/from text entirely and so be undoubtedly correct and probably more efficient. However it also would be more difficult, especially for NUMERIC types as we would need to convert them to/from the protocol wire format ourselves, so for now just make it work correctly in the simplest possible way.
Showing with 26 additions and 11 deletions