Added table identifier to OrderBy to avoid column ambiguity on joins.

This commit is contained in:
Kharenis 2023-07-26 19:54:41 +01:00
parent 15e343d22d
commit b01e72311e
1 changed files with 1 additions and 1 deletions

View File

@ -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($"\"{_table}\".\"{sortKey}\" {sortDirection} LIMIT {pagingSpec.PageSize} OFFSET {pagingOffset}");
return queryFunc(builder).ToList();
}