Review main Merged

83523[BUGFIX] Ensure working count query in `DatabaseRecordList::getTable()`

Stefan Bürk CR +2 V +2 Easy +7 −1 updated 04/08/24, 09:46

Commit message

`\TYPO3\CMS\Backend\RecordList\DatabaseRecordList` provides the ability
to modify the QueryBuilder used for the record list representation with
the PSR-14 `ModifyDatabaseQueryForRecordListingEvent`, after generic
query information like default orderings and similar have been added.

That is covered within the `getQueryBuilder()` method, which is used in
other class methods, for example in `getTables()` where it is changed
to a `COUNT()` query.

MariaDB for example is picky about count queries using `order by`,
`group by` or aggregation methods which are not reflected or added
in the counter parts leading to a not so useful error like

  Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP
  columns is illegal if there is no GROUP BY clause

or similar variants. This error message can be missleading for the
case a order by has been used along with a COUNT() query.

Listener of the event do not get the information if order-by can
be added or should be left out, therefore maybe adding sorting
conditions for a count query.

This change now resets any order statements for the count-query
like other places in the TYPO3 core.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Thomas Hohn +1
    • Garvin Hicking +1
    • Christian Kuhn +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Garvin Hicking +1
    • Christian Kuhn +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1924

  1. Stefan Bürk uploaded patch set 1 03/19/24, 13:51

  2. core-ci voted on patch set 1 V +1 03/19/24, 13:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54694

  3. Stefan Bürk commented on patch set 1 03/19/24, 14:01

    Backport v11 INFO (will take care of it): * Hook `$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][DatabaseRecordList::class]['modifyQuery']` instead of PSR-14 event (commit message) * resetQueryPart() has to be used instead of `resetOrderBy()` and `resetGroupBy()` (commit message & code)
  4. Christian Kuhn updated the commit message in patch set 2 V +1 03/19/24, 14:04

  5. Christian Kuhn voted on patch set 2 CR +1 V +1 03/19/24, 14:04

  6. core-ci voted on patch set 2 V +1 03/19/24, 14:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54696

  7. Mark Houben voted on patch set 2 CR +1 V +1 03/19/24, 14:17

  8. Garvin Hicking voted on patch set 2 CR +1 V +1 03/19/24, 14:31

  9. Stefan Bürk voted on patch set 2 CR -1 03/19/24, 14:32

  10. Stefan Bürk voted on patch set 2 CR +2 V +2 03/19/24, 14:33

  11. Stefan Bürk voted on patch set 2 CR -1 03/19/24, 15:09

  12. Stefan Bürk voted on patch set 2 CR -2 03/19/24, 15:57

  13. Stefan Bürk uploaded patch set 3 CR +1 V +1 03/27/24, 10:37

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  14. core-ci voted on patch set 3 V -1 03/27/24, 10:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54991

  15. Stefan Bürk uploaded patch set 4 V -1 03/27/24, 10:56

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  16. core-ci voted on patch set 4 V +1 03/27/24, 11:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54994

  17. Stefan Bürk uploaded patch set 5 V +1 03/27/24, 13:35

    Copied Votes: * Code-Review-2 (copy condition: "changekind:NO_CHANGE OR **is:MIN**")
  18. core-ci voted on patch set 5 V +1 03/27/24, 13:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/54998

  19. Stefan Bürk voted on patch set 5 CR 0 03/27/24, 14:13

  20. Garvin Hicking voted on patch set 5 CR +1 V +1 04/04/24, 15:17

  21. Thomas Hohn voted on patch set 5 CR +1 04/08/24, 08:06

  22. Christian Kuhn voted on patch set 5 CR +1 V +1 04/08/24, 08:55

  23. Stefan Bürk voted on patch set 5 CR +2 V +2 04/08/24, 09:46

  24. Stefan Bürk merged patch set 6 04/08/24, 09:46