Hello,
I found a very strange cast to character varying in UPDATE statement when setting a field to NULL with postgresql dialect. When a default or mysql dialect is used everything works as expected.
The reproducing code is (clojure + suricatta):
user=> (fmt/sqlvec (-> (dsl/update :foo) (dsl/set :foo nil)))
["update foo set foo = ?" nil]
user=> (fmt/sqlvec (-> (dsl/update :foo) (dsl/set :foo nil)) {:dialect :postgresql})
["update foo set foo = cast(? as varchar)" nil]
That will translate to something like this in groovy/java:
def update = DSL.update(DSL.table("foo"))
def conf = (new DefaultConfiguration()).set(org.jooq.SQLDialect.POSTGRES)
def ctx = DSL.using(conf)
ctx.render(update.set([((DSL/field "foo"))]: null]))
// => "update foo set foo = cast(? as varchar)"
This behavior makes me imposible to set a field to NULL. I don't know if is something related to Clojure<->java interop or is just a bug in jOOQ. But my first impression is that something wrong is in postgresql dialect.
Thanks.
Andrey
--