Skip to content
Snippets Groups Projects
Commit 6afe6c02 authored by Cam Saül's avatar Cam Saül
Browse files

Merge pull request #484 from metabase/fix_cant_infer_sql_type_for_date

fix "can't infer SQL type" error
parents d1e607a3 f5e0fc16
No related branches found
No related tags found
No related merge requests found
......@@ -150,7 +150,8 @@
[_ field-id & _] {(field-id->kw field-id)
;; If the field in question is a date field we need to cast the YYYY-MM-DD string that comes back from the UI to a SQL date
(let [cast-value-if-needed (fn [v]
(cond (= (type v) java.sql.Date) `(raw ~(format "CAST('%s' AS DATE)" (.toString ^java.sql.Date v)))
(cond (or (= (type v) java.sql.Date)
(= (type v) java.util.Date)) `(raw ~(format "CAST('%s' AS DATE)" (.toString ^java.sql.Date v)))
(not (string? v)) v
(date-field-id? field-id) (u/parse-date-yyyy-mm-dd v)
(= (field-id->special-type field-id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment