.append("  pg_class.oid = '" + tableName + "'::regclass AND ")
.append("  indrelid = pg_class.oid AND ")
.append("  pg_class.relnamespace = pg_namespace.oid AND ")
.append("  pg_attribute.attrelid = pg_class.oid AND ")
.append("  pg_attribute.attnum = any(pg_index.indkey) ")
<BUG>.append(" AND indisprimary")
</BUG>
.toString();
Set<String> primaryKeyColumns = Sets.newLinkedHashSet();
try (Statement statement = connection.createStatement()) {

.append("  pg_class.oid = '" + tableName + "'::regclass AND ")
.append("  indrelid = pg_class.oid AND ")
.append("  pg_class.relnamespace = pg_namespace.oid AND ")
.append("  pg_attribute.attrelid = pg_class.oid AND ")
.append("  pg_attribute.attnum = any(pg_index.indkey) ")
.append("  AND indisprimary")
.toString();
Set<String> primaryKeyColumns = Sets.newLinkedHashSet();
try (Statement statement = connection.createStatement()) {
