Skip to content
Snippets Groups Projects
Commit 08a78a57 authored by Stefan Bürk's avatar Stefan Bürk
Browse files

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

`\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.

Resolves: #103427
Releases: main, 12.4, 11.5
Change-Id: Ie421993a1890dd6682d02f54203d538e6ae1b76c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83532


Reviewed-by: default avatarGarvin Hicking <gh@faktor-e.de>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarGarvin Hicking <gh@faktor-e.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
parent fba8c065
Branches
Tags
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment