(str"extract("(nameunit)" from "(hformat/to-sqlexpr)")"))
;; HoneySQL 0.7.0+ parameterizes numbers to fix issues with NaN and infinity -- see https://github.com/jkk/honeysql/pull/122.
;; However, this broke some of Metabase's behavior, specifically queries with calculated columns with numeric literals --
;; some SQL databases can't recognize that a calculated field in a SELECT clause and a GROUP BY clause is the same thing if the calculation involves parameters.
;; Go ahead an use the old behavior so we can keep our HoneySQL dependency up to date.
(extend-protocolhoneysql.format/ToSql
java.lang.Number
(to-sql[x](strx)))
;; HoneySQL automatically assumes that dots within keywords are used to separate schema / table / field / etc.
;; To handle weird situations where people actually put dots *within* a single identifier we'll replace those dots with lozenges,
;; let HoneySQL do its thing, then switch them back at the last second