-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Labels
type: bugA general bugA general bug
Description
Hello,
I have found an issue in 2.7.1 with adding order by
by sort to a query that already has order by.
It happens only in specific scenarios/combinations of the clauses. See the test method bellow.
@Test
void testOrderBy(){
Sort sort = Sort.by(Sort.Order.desc("age"));
//works
assertThat(QueryUtils.applySorting("SELECT * FROM t \n" //
+ "WHERE true \n"
+ "ORDER BY (case when t.id in :priorityIds then 1 else 2 end)\n" //
+ "", sort))
.endsWith("ORDER BY (case when t.id in :priorityIds then 1 else 2 end)\n" + ", age desc");
//works
assertThat(QueryUtils.applySorting("SELECT * FROM t \n" //
+ "WHERE (true OR false) \n"
+ "ORDER BY t.id\n" //
+ "", sort))
.endsWith("ORDER BY t.id\n" + ", age desc");
//not working
assertThat(QueryUtils.applySorting("SELECT * FROM t \n" //
+ "WHERE (true OR false) \n"
+ "ORDER BY (case when t.id in :priorityIds then 1 else 2 end)\n" //
+ "", sort))
.endsWith("ORDER BY (case when t.id in :priorityIds then 1 else 2 end)\n" + ", age desc");
}
It seems to be related to this change of the regex pattern: 6fd829c .
The issue is not present in 2.7.0.
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug