[jOOQ/jOOQ#17288] NullPointerException in MetaImpl.getUniqueKeys() query when unique key cannot look up column references
This commit is contained in:
parent
0592a782b1
commit
77496dd1c5
@ -1146,7 +1146,10 @@ final class MetaImpl extends AbstractMeta {
|
||||
|
||||
groups.forEach((k, v) -> {
|
||||
v.sortAsc(5);
|
||||
result.add(createUniqueKey(v, 4, 3, false));
|
||||
UniqueKey<Record> key = createUniqueKey(v, 4, 3, false);
|
||||
|
||||
if (key != null)
|
||||
result.add(key);
|
||||
});
|
||||
}
|
||||
|
||||
@ -1404,6 +1407,12 @@ final class MetaImpl extends AbstractMeta {
|
||||
for (Field<?> field : fields())
|
||||
if (field.getName().equalsIgnoreCase(name))
|
||||
f[i] = (TableField<Record, ?>) field;
|
||||
|
||||
// [#17288] Ignore the key if columns cannot be looked up.
|
||||
if (f[i] == null) {
|
||||
log.info("Cannot look up unique key column " + columnName + " in table: " + this + ". Consider reporting https://jooq.org/bug");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
String indexName = result.get(0).get(keyName, String.class);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user