From fdf2a0bc7a52f98020fd3adf6308d1e102333352 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Fri, 18 Aug 2023 18:18:06 +0200 Subject: [PATCH] [jOOQ/jOOQ#11485] Work around https://github.com/trinodb/trino/issues/18733 --- jOOQ/src/main/java/org/jooq/impl/JSONEntryImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/impl/JSONEntryImpl.java b/jOOQ/src/main/java/org/jooq/impl/JSONEntryImpl.java index ddb4652103..94dd2cf5d8 100644 --- a/jOOQ/src/main/java/org/jooq/impl/JSONEntryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/JSONEntryImpl.java @@ -299,11 +299,12 @@ final class JSONEntryImpl extends AbstractQueryPart implements JSONEntry, case TRINO: // [#11485] CHAR types can't be cast to JSON: https://trino.io/docs/current/functions/json.html#cast-to-json - if (type.getSQLDataType() == SQLDataType.CHAR) - return field.cast(VARCHAR); - // [#11485] UUID types neither: https://github.com/trinodb/trino/issues/16579 - else if (type.isUUID()) + // [#11485] No temporal types except TIMESTAMP can be cast to JSON: https://github.com/trinodb/trino/issues/18733 + if (type.getSQLDataType() == SQLDataType.CHAR || + type.isUUID() || + type.isTemporal() && !type.isTimestamp() + ) return field.cast(VARCHAR); else