Fix ONLY_FULL_GROUP_BY violations in getCount() and Legacy GROUP BY tests#278
Open
opengeek wants to merge 1 commit intomodxcms:3.xfrom
Open
Fix ONLY_FULL_GROUP_BY violations in getCount() and Legacy GROUP BY tests#278opengeek wants to merge 1 commit intomodxcms:3.xfrom
opengeek wants to merge 1 commit intomodxcms:3.xfrom
Conversation
ab09aa1 to
3763642
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Closes #190. MySQL 8.0 enforces ONLY_FULL_GROUP_BY by default. Two pre-existing violations caused all MySQL CI jobs to fail after upgrading the CI service image to mysql:8.0 (PR #277).
Files and methods changed
src/xPDO/xPDO.php—xPDO::getCount(): replaced$query->select($expr)with$query->select('1')so the subquery inner SELECT is always GROUP BY-compliant.test/xPDO/Legacy/Om/xPDOQueryHavingTest.php—testHavingWithGroupBy(): added missingidandcolorcolumns to GROUP BY to match the implicit SELECT *.test/xPDO/Legacy/Om/xPDOQueryLimitTest.php—testLimitWithGroupBy(): added missingidandnamecolumns to GROUP BY for the same reason.Cross-driver impact
The
getCount()fix is universal (all drivers). The test fixes are MySQL-8-triggered but correct for all drivers that enforce GROUP BY strictness.Test coverage
SQLite suite passing: 35 tests, 35 assertions. MySQL CI will verify against mysql:8.0 in PR #277 after this merges to 3.x.
Breaking change assessment
No public API change.
getCount()return value is unchanged —SELECT 1produces the same row count asSELECT {pk}for the purpose of the outerCOUNT(*). Safe for patch-level consumers.Contributors
Reported via CI failures on PR #277.