From 65cb182c98cef9b0635868b56a63ae8220bb542b Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Fri, 5 Apr 2013 11:50:25 +1300 Subject: [PATCH] BUG Don't sort when deleting records in ManyManyList::removeAll() This breaks databases like MSSQL which don't allow an ORDER BY with a subquery at the same time. DELETE queries don't need to be ordered, so we can safely remove the default. --- model/ManyManyList.php | 1 + 1 file changed, 1 insertion(+) diff --git a/model/ManyManyList.php b/model/ManyManyList.php index defb15fa9..a0c0d7b00 100644 --- a/model/ManyManyList.php +++ b/model/ManyManyList.php @@ -181,6 +181,7 @@ class ManyManyList extends RelationList { unset($from[$this->joinTable]); $query->setFrom($from); $query->setDistinct(false); + $query->setOrderBy(null, null); // ensure any default sorting is removed, ORDER BY can break DELETE clauses // Use a sub-query as SQLite does not support setting delete targets in // joined queries.