Fix float-to-string to accept integers, fix #249.

The problem in #249 is that SQLite is happy processing floats in an
integer field, so pgloader needs to be instructing via the CAST
mechanism to cast to float at migration time.

But then the transformation function would choke on integers, because of
its optimisation "declare" statement. Of course the integer
representation expected by PostgreSQL is float-compatible, so just
instruct the function that integers are welcome to the party.
This commit is contained in:
Dimitri Fontaine 2015-06-27 19:30:34 +02:00
parent 1c7de22096
commit 5f85bf542a

View File

@ -150,7 +150,7 @@
(defun float-to-string (float)
"Transform a Common Lisp float value into its string representation as
accepted by PostgreSQL, that is 100.0 rather than 100.0d0."
(declare (type (or null float string) float))
(declare (type (or null fixnum float string) float))
(when float
(typecase float
(double-float (let ((*read-default-float-format* 'double-float))