1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-20 21:54:58 -04:00

Added table identifier to OrderBy to avoid column ambiguity on joins

Co-Authored-By: Richard <1252123+kharenis@users.noreply.github.com>
This commit is contained in:
Qstick
2023-08-10 21:07:27 -05:00
parent a13011aa49
commit c57ceac4de
2 changed files with 9 additions and 14 deletions
@@ -429,7 +429,7 @@ namespace NzbDrone.Core.Datastore
var sortKey = TableMapping.Mapper.GetSortKey(pagingSpec.SortKey);
var sortDirection = pagingSpec.SortDirection == SortDirection.Descending ? "DESC" : "ASC";
var pagingOffset = Math.Max(pagingSpec.Page - 1, 0) * pagingSpec.PageSize;
builder.OrderBy($"\"{sortKey}\" {sortDirection} LIMIT {pagingSpec.PageSize} OFFSET {pagingOffset}");
builder.OrderBy($"\"{sortKey.Table ?? _table}\".\"{sortKey.Column}\" {sortDirection} LIMIT {pagingSpec.PageSize} OFFSET {pagingOffset}");
return queryFunc(builder).ToList();
}