Parsing for double precision not working yet

Marijn Haverbeke marijnh at gmail.com
Thu Nov 28 12:24:47 UTC 2013


Yes, see my response on github. No need to send through multiple channels.

On Wed, Nov 27, 2013 at 3:01 PM, Daniel Brunner <daniel at dbrunner.de> wrote:
> [NB: Marjin, I already posted this issue on Github]
>
> Hello!
>
> There is a problem with columns with double precision.
>
> Test case:
> --8<--
> (pomo:query "create table ftest (value double precision)")
> (pomo:query "insert into ftest values ($1)" (coerce 100.10 'double-float))
> --8<--
>
> This fails with:
> --8<--
> Database error 22P02: invalid input syntax for type double precision:
> "100.0999984741211D0"
>    [Condition of type CL-POSTGRES-ERROR:DATA-EXCEPTION]
> --8<--
>
> A short patch in cl-postgres/sql-string.lisp could solve that problem:
>
> --8<--
> diff --git a/cl-postgres/sql-string.lisp b/cl-postgres/sql-string.lisp
> index 3157d30..4dff4be 100644
> --- a/cl-postgres/sql-string.lisp
> +++ b/cl-postgres/sql-string.lisp
> @@ -84,6 +84,8 @@ whether the string should be escaped before being put
> into a query.")
>      (princ-to-string arg))
>    (:method ((arg float))
>      (format nil "~f" arg))
> +  (:method ((arg double-float))
> +    (format nil "~,,,,,,'EE" arg))
>    (:method ((arg ratio))
>      ;; Possible optimization: we could probably build up the same
> binary structure postgres
> --8<--
>
>
> Best wishes,
> Daniel
>



More information about the postmodern-devel mailing list