[#8070] Cannot create tables with VARCHAR(n) ARRAY types in HSQLDB

This commit is contained in:
lukaseder 2018-11-27 14:33:51 +01:00
parent e392b4eb65
commit 08f49f04c2
2 changed files with 7 additions and 2 deletions

View File

@ -52,7 +52,7 @@ final class ArrayDataType<T> extends DefaultDataType<T[]> {
*/
private static final long serialVersionUID = 7883229760246533448L;
private final DataType<T> elementType;
final DataType<T> elementType;
public ArrayDataType(DataType<T> elementType) {
super(null, elementType.getArrayType(), elementType.getTypeName(), elementType.getCastTypeName());

View File

@ -4306,6 +4306,9 @@ final class Tools {
}
static final void toSQLDDLTypeDeclaration(Context<?> ctx, DataType<?> type) {
DataType<?> elementType = (type instanceof ArrayDataType)
? ((ArrayDataType<?>) type).elementType
: type;
// In some databases, identity is a type, not a flag.
if (type.identity()) {
@ -4372,7 +4375,9 @@ final class Tools {
}
String typeName = type.getTypeName(ctx.configuration());
if (type.hasLength()) {
// [#8070] Make sure VARCHAR(n) ARRAY types are generated as such in HSQLDB
if (type.hasLength() || elementType.hasLength()) {
// [#6289] [#7191] Some databases don't support lengths on binary types
if (type.isBinary() && NO_SUPPORT_BINARY_TYPE_LENGTH.contains(ctx.family()))