From 233fa3e9815f058abc08ecb2854e8a85d031da07 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Mon, 1 Sep 2025 10:45:57 +0200 Subject: [PATCH] [jOOQ/jOOQ#18965] Bad DDL generated when attempting to CREATE TABLE with UUID column in Oracle and other dialects --- jOOQ/src/main/java/org/jooq/impl/Tools.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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());