      (number? val)           (int val)
      :else                   (try
                                (Integer/parseInt val)
-                               (catch Exception _ default)))))
+                               (catch Exception _ (int default))))))
 
 (defn val->long
   ([val]

     val
     (try
       (Boolean/parseBoolean val)
       (catch Exception _ default)))))

(defn json->clj
  ([json]

     (number? val)       (long val)
     :else               (try
                           (Long/parseLong val)
                           (catch Exception _ (long default))))))

;; Warning Postgres type float is equivalent to java Double, and Postgres real is equivalent to java Float
(defn val->float
