[#5807] Exception thrown when creating table with SQLDataType.UUID in MySQL

This commit is contained in:
lukaseder 2017-09-20 10:35:49 +02:00
parent 493679b7d0
commit 0736ed2193

View File

@ -123,6 +123,7 @@ import static org.jooq.impl.Keywords.K_START_WITH;
import static org.jooq.impl.Keywords.K_THEN;
import static org.jooq.impl.Keywords.K_THROW;
import static org.jooq.impl.Keywords.K_WHEN;
import static org.jooq.impl.SQLDataType.VARCHAR;
import static org.jooq.impl.Tools.DataKey.DATA_BLOCK_NESTING;
import static org.jooq.tools.reflect.Reflect.accessible;
@ -3879,6 +3880,17 @@ 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.hasLength()) {
// [#6289] Some databases don't support lengths on binary types