[#5334] Nested record generated when TABLE.COLUMN "overlaps" with a table called TABLE_COLUMN for MySQL

This commit is contained in:
lukaseder 2016-06-07 23:05:40 +03:00
parent 05c309ddfc
commit a0f55fa4b8

View File

@ -43,6 +43,7 @@ package org.jooq.util;
import static java.util.Arrays.asList;
import static org.jooq.SQLDialect.MYSQL;
import static org.jooq.SQLDialect.POSTGRES;
import static org.jooq.tools.StringUtils.defaultIfBlank;
import static org.jooq.tools.StringUtils.defaultString;
import static org.jooq.util.AbstractGenerator.Language.JAVA;
@ -4980,7 +4981,8 @@ public class JavaGenerator extends AbstractGenerator {
}
// [#3942] PostgreSQL treats UDTs and table types in similar ways
else if (db.getTable(schema, u) != null) {
// [#5334] In MySQL, the user type is (ab)used for synthetic enum types. This can lead to accidental matches here
else if (db.getDialect().family() == POSTGRES && db.getTable(schema, u) != null) {
type = getStrategy().getFullJavaClassName(db.getTable(schema, u), udtMode);
}
@ -5037,7 +5039,8 @@ public class JavaGenerator extends AbstractGenerator {
sb.append(".getDataType()");
}
// [#3942] PostgreSQL treats UDTs and table types in similar ways
else if (db.getTable(schema, u) != null) {
// [#5334] In MySQL, the user type is (ab)used for synthetic enum types. This can lead to accidental matches here
else if (db.getDialect().family() == POSTGRES && db.getTable(schema, u) != null) {
sb.append(getStrategy().getFullJavaIdentifier(db.getTable(schema, u)));
sb.append(".getDataType()");
}