private String getPkColumnName()

in src/main/java/com/epam/digital/data/platform/history/repository/HistoryDataRepository.java [64:75]


  private String getPkColumnName(String tableName) {
    var table = catalog
            .lookupTable(schema, tableName)
            .orElseThrow(() -> new IllegalArgumentException("No such table: " + tableName));
    return Optional.ofNullable(table.getPrimaryKey())
        .map(TableConstraint::getColumns)
        .map(Collection::stream)
        .flatMap(Stream::findFirst)
        .orElseThrow(
            () -> new IllegalArgumentException("No primary key found in table: " + table.getName()))
        .getName();
  }