You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i face same problem in mssql.default order also append to the sql: ............................ ORDER BY [project->supervisionOrder].[name] ASC ORDER BY [report].[reportid] OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;
this not happen when not set Pagination (offset and limit)
so i think this is cause by pagination.
except fix it!
Struggling with the same problem: Sequelize is adding a default order by primary key when you are including an association while using limit or offset, so if you add ordering by model's primary key it generates wrong sql.
I thought this solution, just adding a check for mainQueryOrder.
if(!options.order||options.include&&(!orders.subQueryOrder.length||!orders.mainQueryOrder.length)){fragment+=options.order&&!isSubQuery ? ', ' : ' ORDER BY ';fragment+=this.quoteTable(options.tableAs||model.name)+'.'+this.quoteIdentifier(model.primaryKeyField);`}`
Activity
lerit commentedon Jan 31, 2018
i face same problem in mssql.default order also append to the sql:
............................ ORDER BY [project->supervisionOrder].[name] ASC ORDER BY [report].[reportid] OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY;this not happen when not set Pagination (offset and limit)
so i think this is cause by pagination.
except fix it!
blaivs commentedon Feb 7, 2018
Struggling with the same problem: Sequelize is adding a default order by primary key when you are including an association while using limit or offset, so if you add ordering by model's primary key it generates wrong sql.
I thought this solution, just adding a check for mainQueryOrder.
It passes all the tests for last release