[postmodern-devel] cl-postgres fails to read an empty array
Andy Chambers
achambers at mcna.net
Thu Nov 3 20:17:01 UTC 2011
Hi,
I'm not sure if this is the case in the latest version of postgresql
but in my version, it fails to read an empty integer correctly from
the DB. The following patch fixes for me...
diff --git Postmodern/cl-postgres/interpret.lisp Postmodern/cl-postgres/\
interpret.lisp
index 7d30f75..a6ce46f 100644
--- Postmodern/cl-postgres/interpret.lisp
+++ Postmodern/cl-postgres/interpret.lisp
@@ -196,8 +196,13 @@ used. Correct for sign bit when using integer format."
(unless (< (incf pos) (length value)) (return
ws)))
'simple-vector)))))
+(defun maybe-parse-integer (s)
+ (if (string= "" s)
+ :null
+ (parse-integer s)))
+
;; Integral array types
-(let ((read-integral (read-array-value #'parse-integer)))
+(let ((read-integral (read-array-value #'maybe-parse-integer)))
(dolist (oid '(1561 1005 1007 1016 1028))
(set-sql-reader oid read-integral)))
Cheers,
Andy
More information about the postmodern-devel
mailing list