Skip to content

[5.5] clone query without order by for aggregates #19022

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2017

Conversation

vetruvet
Copy link
Contributor

@vetruvet vetruvet commented May 1, 2017

Right now if there is a global scope that applies an order to the query, it will break counts and other aggregates when MySQL is in strict mode and there is no group-by in place (see issues like 15232, 18789, 14997, etc). This change is to fix that without having to set MySQL to non-strict mode or tell users to change their strict mode flags. It's also a low-impact change - if there are no groupings on the query, then any order is irrelevant anyway so this does not have any side-effects.

@tillkruss tillkruss changed the title clone query without order by for aggregates [5.5] clone query without order by for aggregates May 1, 2017
@taylorotwell taylorotwell merged commit a2aa22f into laravel:master May 4, 2017
@vetruvet
Copy link
Contributor Author

vetruvet commented May 4, 2017

@taylorotwell if I PR this on the 5.4 branch, can this get merged for a future 5.4.x patch release?

@vetruvet vetruvet deleted the remove-order-on-aggregates branch May 4, 2017 16:42
@mfn
Copy link
Contributor

mfn commented Oct 30, 2017

@vetruvet you only mentioned MySQL but I can attest the same fix is necessary for Postgres too. We previously used a local workaround which, thank to your PR, isn't needed anymore 👍

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.

3 participants