From 5f85bf542ab65350a1ce6ff0c8b62f8ea29647a8 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 27 Jun 2015 19:30:34 +0200 Subject: [PATCH] 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. --- src/utils/transforms.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/transforms.lisp b/src/utils/transforms.lisp index 209c69d..fd06cdc 100644 --- a/src/utils/transforms.lisp +++ b/src/utils/transforms.lisp @@ -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))