Expand test for #73 to other databases

This verifies that it is _only_ PostgreSQL that cannot do this 
conversion!
This commit is contained in:
Sean Corfield 2019-11-13 10:51:14 -08:00
parent e404c47d83
commit e82094dd86

View file

@ -222,13 +222,13 @@ VALUES ('Pear', 'green', 49, 47)
(doall (take 3 (jdbc/plan (ds) ["select * from fruit"])))))) (doall (take 3 (jdbc/plan (ds) ["select * from fruit"]))))))
(deftest issue-73 (deftest issue-73
(when (postgres?) ;; only postgresql cannot convert a java.util.Date to a timestamp column...
(try (try
(jdbc/execute-one! (ds) ["drop table temp_table"]) (jdbc/execute-one! (ds) ["drop table temp_table"])
(catch Throwable _)) (catch Throwable _))
(jdbc/execute-one! (ds) ["create table temp_table (id serial primary key, deadline timestamp not null)"]) (jdbc/execute-one! (ds) ["create table temp_table (id int not null, deadline timestamp not null)"])
(try (try
(jdbc/execute-one! (ds) ["insert into temp_table (deadline) values (?)" (java.util.Date.)]) (jdbc/execute-one! (ds) ["insert into temp_table (id, deadline) values (?,?)" 1 (java.util.Date.)])
(catch Throwable t (catch Throwable t
(println "Issue #73: PostgreSQL cannot convert java.util.Date to timestamp by default?") (println "Issue #73:" (db) "cannot convert java.util.Date to timestamp by default?")
(println (ex-message t)))))) (println (ex-message t)))))