[#5182] Meta Table.getKeys() returns an empty list containing null, if a table has no primary key

This commit is contained in:
lukaseder 2016-04-01 13:21:00 +02:00
parent b6b197c678
commit 854a70fd2c

View File

@ -81,7 +81,8 @@
package org.jooq.impl;
import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
// ...
import static org.jooq.SQLDialect.MARIADB;
import static org.jooq.SQLDialect.MYSQL;
@ -493,7 +494,8 @@ final class MetaImpl implements Meta, Serializable {
@Override
public final List<UniqueKey<Record>> getKeys() {
return unmodifiableList(asList(getPrimaryKey()));
UniqueKey<Record> pk = getPrimaryKey();
return pk == null ? emptyList() : singletonList(pk);
}
@Override