diff --git a/jOOQ/src/main/java/org/jooq/impl/Tools.java b/jOOQ/src/main/java/org/jooq/impl/Tools.java index aa16513e62..b9db48c757 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Tools.java +++ b/jOOQ/src/main/java/org/jooq/impl/Tools.java @@ -733,6 +733,7 @@ final class Tools { private static final EnumSet REQUIRES_BACKSLASH_ESCAPING = EnumSet.of(MARIADB, MYSQL); private static final EnumSet NO_SUPPORT_NULL = EnumSet.of(DERBY, FIREBIRD, HSQLDB); private static final EnumSet NO_SUPPORT_BINARY_TYPE_LENGTH = EnumSet.of(POSTGRES); + private static final EnumSet NO_SUPPORT_CAST_TYPE_IN_DDL = EnumSet.of(MARIADB, MYSQL); private static final EnumSet DEFAULT_BEFORE_NULL = EnumSet.of(FIREBIRD, HSQLDB); private static final EnumSet SUPPORT_MYSQL_SYNTAX = EnumSet.of(MARIADB, MYSQL); @@ -4673,14 +4674,9 @@ final class Tools { } // [#5807] These databases cannot use the DataType.getCastTypeName() (which is simply char in this case) - if (type.getType() == UUID.class) { - switch (ctx.family()) { - case MARIADB: - case MYSQL: { - toSQLDDLTypeDeclaration(ctx, VARCHAR(36)); - return; - } - } + if (type.getType() == UUID.class && NO_SUPPORT_CAST_TYPE_IN_DDL.contains(ctx.family())) { + toSQLDDLTypeDeclaration(ctx, VARCHAR(36)); + return; } String typeName = type.getTypeName(ctx.configuration()); @@ -4694,6 +4690,10 @@ final class Tools { else if (type.length() > 0) ctx.sql(typeName).sql('(').sql(type.length()).sql(')'); + // [#6745] The DataType.getCastTypeName() cannot be used in some dialects, for DDL + else if (NO_SUPPORT_CAST_TYPE_IN_DDL.contains(ctx.family())) + ctx.sql(SQLDataType.CLOB.getTypeName(ctx.configuration())); + // Some databases don't allow for length-less VARCHAR, VARBINARY types else { String castTypeName = type.getCastTypeName(ctx.configuration());