For large 'in' conditions in Postgres the following
IN (VALUES ('a'),('b'),('c'))
can lead to much more efficient query plans than
IN ('a','b','c')
In JOOQ I can express this with
Field f = ...
Row1[] rows = new Row1[array.length];
for (int i=0;i<array.length;i++)
rows[i] = DSL.row(array[i]);
Condition c = f.in(DSL.selectFrom(DSL.values(rows)));
But what if I need to cast the values? To be more specific, when comparing values with a citext column at least one of the values needs to be explicitly cast to citext for the query to work. Example:
select distinct "x0"."pk"
from "sometable" as "x0"
where "x0"."external_shared_id" in ( values
('ext0308174863'::citext),
('ext1560238348'))
How can I write this with JOOQ?