diff --git a/jOOQ/src/main/java/org/jooq/impl/Tools.java b/jOOQ/src/main/java/org/jooq/impl/Tools.java index af0ba97f6a..ff5bbdf7a2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Tools.java +++ b/jOOQ/src/main/java/org/jooq/impl/Tools.java @@ -6166,8 +6166,14 @@ final class Tools { } } + String typeName = type.getTypeName(ctx.configuration()); + // [#5807] These databases cannot use the DataType.getCastTypeName() (which is simply char in this case) - if (type.getFromType() == UUID.class && NO_SUPPORT_CAST_TYPE_IN_DDL.contains(ctx.dialect())) { + // [#18965] Or, they require a length, but UUID.hasLength() is false + if (type.getFromType() == UUID.class && ( + NO_SUPPORT_CAST_TYPE_IN_DDL.contains(ctx.dialect()) + || typeName.startsWith("varchar") + )) { toSQLDDLTypeDeclaration(ctx, VARCHAR(36)); return; } @@ -6182,7 +6188,6 @@ final class Tools { } DataType elementType = type.getArrayBaseDataType(); - String typeName = type.getTypeName(ctx.configuration());