Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ SELECT COUNT(*)
ON p.vector_item_id = """ + pointJoinExpression() + """
WHERE p.projection_id = :projectionId
""" + where + """
ORDER BY """ + JdbcVectorProjectionSql.orderByDisplayOrder(postgres) + """
""" + JdbcVectorProjectionSql.orderByDisplayOrderClause(postgres) + """
LIMIT :limit OFFSET :offset
""", params, rowMapper);
return new ProjectionPointPage(total == null ? 0L : total, items);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ static String orderByDisplayOrder(boolean postgres) {
}
return "p.display_order IS NULL, p.display_order, p.vector_item_id";
}

static String orderByDisplayOrderClause(boolean postgres) {
return " ORDER BY " + orderByDisplayOrder(postgres);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ void mysqlJsonTextUsesParameterizedPath() {
assertThat(JdbcVectorProjectionSql.jsonText(null, ":filterKey0", false))
.isEqualTo("JSON_UNQUOTE(JSON_EXTRACT(metadata, CONCAT('$.', :filterKey0)))");
}

@Test
void orderByDisplayOrderClauseKeepsSpaceAfterOrderBy() {
assertThat(JdbcVectorProjectionSql.orderByDisplayOrderClause(true))
.isEqualTo(" ORDER BY p.display_order NULLS LAST, p.vector_item_id");
assertThat("WHERE p.projection_id = :projectionId" + JdbcVectorProjectionSql.orderByDisplayOrderClause(true))
.contains(" ORDER BY p.display_order");
}
}
Loading