Skip to content

[13.x] Ensure insertOrIgnoreReturning only marks records as modified when rows are inserted#59083

Merged
taylorotwell merged 2 commits intolaravel:13.xfrom
jackbayliss:13.x-insertOrIgnoreEnsure-recordsHaveBeenModified
Mar 5, 2026
Merged

[13.x] Ensure insertOrIgnoreReturning only marks records as modified when rows are inserted#59083
taylorotwell merged 2 commits intolaravel:13.xfrom
jackbayliss:13.x-insertOrIgnoreEnsure-recordsHaveBeenModified

Conversation

@jackbayliss
Copy link
Contributor

@jackbayliss jackbayliss commented Mar 5, 2026

If all the rows conflict, nothing is inserted.

I noticed $this->connection->recordsHaveBeenModified(); was being called regardless - which means if you use a sticky connection subsequent reads hit the write server unnecessarily.

This aligns the behavior with insertOrIgnore, which only marks the connection as modified when rows are actually affected.

13.x cause thats where insertOrIgnoreReturning is.. :)

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss jackbayliss marked this pull request as ready for review March 5, 2026 00:34
@jackbayliss jackbayliss changed the title [13.x] Ensure insertOrIgnoreReturning only marks connection as modified when rows are inserted [13.x] Ensure insertOrIgnoreReturning only marks records as modified when rows are inserted Mar 5, 2026
@taylorotwell taylorotwell merged commit 842bbaa into laravel:13.x Mar 5, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants