honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
sixofhearts 2020-12-14T14:06:51.227300Z

Hi honeybees, I've got a question that's probably been asked a dozen times, but here goes: I'm trying to get a PostgreSQL query returning all columns following an insert, and I think I've followed all directions and it's still not bearing fruit. When I try this (with nilenso's PG extension):

(-> (insert-into :blahs)
    (values [{:blah 1}])
    (psqlh/returning :*)
    sql/format)
I get:
["INSERT INTO blahs (blah) VALUES (?) " 1]
Though I'd expect:
["INSERT INTO blahs (blah) VALUES (?) RETURNING *" 1]
I'm using:
[nilenso/honeysql-postgres "0.2.6"]
[honeysql "0.9.5"]
Can anyone point me in the right direction or have I caught a booboo?

sandqvist 2020-12-14T15:07:08.227400Z

I would guess that you haven't required honeysql-postgres.format anywhere, it contains the formatter multimethod implementations. This is not very clear from the documentation.

sixofhearts 2020-12-14T15:20:18.227600Z

🏆 We have a winner! Thank you Sami, I definitely wouldn't have caught that. Now I can stop appending the string " RETURNING *" and feeling dirty... about that, at least.