-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Closed
Description
- Laravel Version: 8.49.2
- PHP Version: 8.0.11
- Database Driver & Version: mysql
Description:
When saving a model that define touches, the save fails with:
SQLSTATE[HY000]: General error: 1390 Prepared statement contains too many placeholders
If there's too many children in the touched relation.
Steps To Reproduce:
-
Have a model with relationship
-
Have an high number of child in the relationship.
-
Define the relationship in $touches.
-
Update the parent and then save it: the request will fails with the given error message.
Steps to Resolve
I think we need to chunk the $ids before updating, to make sure we doesn't reach the placeholder limit. See:
| $this->getRelated()->newQueryWithoutRelationships()->whereIn($key, $ids)->update($columns); |
Notes
In our case, this happens with a BelongsToMany relationship but I suppose other relationship may be affected.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels