mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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.
This commit is contained in:
parent
ceb7e3c8a8
commit
65cb182c98
@ -181,6 +181,7 @@ class ManyManyList extends RelationList {
|
|||||||
unset($from[$this->joinTable]);
|
unset($from[$this->joinTable]);
|
||||||
$query->setFrom($from);
|
$query->setFrom($from);
|
||||||
$query->setDistinct(false);
|
$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
|
// Use a sub-query as SQLite does not support setting delete targets in
|
||||||
// joined queries.
|
// joined queries.
|
||||||
|
Loading…
Reference in New Issue
Block a user