honeysql

Discussion of https://github.com/seancorfield/honeysql :slightly_smiling_face:
henrik 2017-07-16T06:12:40.383950Z

In honeysql-postgres/test/honeysql_postgres/postgres_test.clj there’s a test for create-table:

(deftest create-table-test
  (testing "create table with two columns"
    (is (= ["CREATE TABLE cities (city varchar(80) PRIMARY KEY, location point)"]
           (-> (create-table :cities)
               (with-columns [[:city (sql/call :varchar 80) (sql/call :primary-key)]
                              [:location :point]])
               sql/format))))
`

henrik 2017-07-16T06:14:10.387968Z

When I run

(-> (pg-helpers/create-table :cities)
    (pg-helpers/with-columns [[:city (sql/call :varchar 80) (sql/call :primary-key)]
                              [:location :point]])
    sql/format)
I get
["CREATE TABLE cities (city varchar(?) PRIMARY KEY, location point)" 
 80] 
rather than
["CREATE TABLE cities (city varchar(80) PRIMARY KEY, location point)"]
as in the test file

henrik 2017-07-16T06:15:25.391426Z

This generates an error when sent on to jdbc, PSQLException ERROR: syntax error at or near “$1”

henrik 2017-07-16T06:15:57.392899Z

So how do I get it to inline the 80 as per the test case?