Due to erasure, we can't know what the type of a generic expression array is:
SQLDialect dialect = SQLDialect.POSTGRES;
Field<String>[] fields = new Field[0];
println(DSL.using(dialect).render(array(fields)));
println(DSL.using(dialect).render(any(array(fields))));
println(DSL.using(dialect).render(val("x").eq(any(array(fields)))));
println(DSL.using(dialect).render(array("x").eq(array(fields))));
This currently prints:
cast(array[] as int[])
any (cast(array[] as int[]))
false
array[?] = cast(array[] as int[])
The int[] casts are wrong, they're just a historic default from org.jooq.impl.Array (probably text[] would have been a better default, as PostgreSQL tends to use text as a default data type, occasionally).
The third result is due to a regression in our implementation of quantified comparison predicates, see:
After fixing #15980, we'll get:
cast(array[] as int[])
any (cast(array[] as int[]))
? = any (cast(array[] as int[]))
array[?] = cast(array[] as int[])
But in all cases, we know the comparison expression's left hand side's type, so we could hint it to the right hand side, as we often do.