Skip to content

Commit

Permalink
Look for field metadata in the qp.store (metabase#38816)
Browse files Browse the repository at this point in the history
Fixes metabase#30454 for x.48.x.
  • Loading branch information
metamben authored Feb 16, 2024
1 parent 5bd99fc commit 55bd57b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions modules/drivers/sqlserver/src/metabase/driver/sqlserver.clj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
[metabase.driver.sql.query-processor :as sql.qp]
[metabase.driver.sql.util :as sql.u]
[metabase.driver.sql.util.unprepare :as unprepare]
[metabase.lib.metadata.protocols :as lib.metadata.protocols]
[metabase.mbql.util :as mbql.u]
[metabase.query-processor.interface :as qp.i]
[metabase.query-processor.store :as qp.store]
[metabase.query-processor.timezone :as qp.timezone]
[metabase.util :as u]
#_{:clj-kondo/ignore [:deprecated-namespace]}
Expand Down Expand Up @@ -559,9 +561,14 @@
(doseq [op [:= :!= :< :<= :> :>= :between]]
(defmethod sql.qp/->honeysql [:sqlserver op]
[driver [_ field :as clause]]
(binding [*compared-field-options* (when (and (vector? field)
(= (get field 0) :field))
(get field 2))]
(binding [*compared-field-options*
(when (and (vector? field)
(= (get field 0) :field))
(merge (let [field-id-or-name (get field 1)]
(when (integer? field-id-or-name)
(lib.metadata.protocols/field (qp.store/metadata-provider)
field-id-or-name)))
(get field 2)))]
((get-method sql.qp/->honeysql [:sql-jdbc op]) driver clause))))

(defmethod driver/db-default-timezone :sqlserver
Expand Down

0 comments on commit 55bd57b

Please sign in to comment.