honeysql

Samuel Ludwig 2026-02-18T21:23:35.946979Z

I'm trying to recreate this statement

SELECT DISTINCT col_name COLLATE latin1_bin FROM X
as found from https://stackoverflow.com/questions/19462919/mysql-select-distinct-should-be-case-sensitive (unrelated, TIL that mysql distinct is case-insensitive by default) I feel like this should work:
(h/format
  {:select [[[:distinct :col_name :!collate-latin1_bin]]]
   :from :x})
but it elides the COLLATE latin1_bin, I'm guessing because :distinct is considered as "special syntax" rather than a function call edit: I've resorted to using :call to get around it
(h/format
  {:select [[[:call :distinct :col_name :!collate-latin1_bin]]]
   :from :x})

seancorfield 2026-02-19T03:21:36.879709Z

That produces SELECT DISTINCT(col_name COLLATE LATIN1_BIN) FROM x -- you're okay with the ( ) there?

seancorfield 2026-02-19T03:23:02.351789Z

Feel free to create an issue for expanding the [:distinct ..] special syntax to support collation etc.