only throw for named param #396

This commit is contained in:
Sean Corfield 2022-04-23 16:03:21 -07:00
parent 270b9439c8
commit 5e847cde0e

View file

@ -1098,7 +1098,10 @@
(let [[sql-x & params-x] (format-expr x {:nested true}) (let [[sql-x & params-x] (format-expr x {:nested true})
[sql-y & params-y] (format-expr y {:nested true}) [sql-y & params-y] (format-expr y {:nested true})
values (unwrap (first params-y) {})] values (unwrap (first params-y) {})]
(when *caching* ;; #396: prevent caching IN () when named parameter is used:
(when (and (meta (first params-y))
(::wrapper (meta (first params-y)))
*caching*)
(throw (ex-info "SQL that includes IN () expressions cannot be cached" {}))) (throw (ex-info "SQL that includes IN () expressions cannot be cached" {})))
(when-not (= :none *checking*) (when-not (= :none *checking*)
(when (or (and (sequential? y) (empty? y)) (when (or (and (sequential? y) (empty? y))