Skip to content
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

do not add order by primary key if there are group by in the query #5608

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

pxpm
Copy link
Contributor

@pxpm pxpm commented Aug 14, 2024

WHY

BEFORE - What was wrong? What was happening before this PR?

Reported in Laravel-Backpack/community-forum#1107

In some rdms with sql_mode=only_full_group_by enabled, adding the primary key order resulted in an error, as the id column was not part of the group by clause.

In that regard, id never makes sense as part of a group by clause, as it should always be unique anyway.

AFTER - What is happening after this PR?

If there is a group by in the query we don't apply the default order by id.

@pxpm pxpm merged commit 3394165 into main Aug 14, 2024
9 checks passed
@pxpm pxpm deleted the do-not-add-order-by-primary-key-when-grouping branch August 14, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant