honeysql 2024-04-24

If you have a reserved SQL keyword as a column name, is there some way to query for it without using the fully-qualified keyword?

(-> (hh/select :to)
      (hh/from :foo))
  ;; "SELECT to FROM foo"
  (-> (hh/select :foo/to)
      (hh/from :foo))
  ;; "SELECT  FROM foo"
desired query is SELECT "to" FROM foo.

Yes, the :quoted parameter is responsible for that. There are other parameters that can affect the relevant behavior.

(sql/format {:select :to})
=> ["SELECT to"]
(sql/format {:select :to} {:quoted true})
=> ["SELECT \"to\""]

@p-himik do you know if there is a way to apply it to a single column in the selection?