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

Exception with RemoveDuplicateSysCategoryRecordMms when ONLY_FULL_GROUP_BY is set #11

Open
Oktopuce opened this issue Oct 21, 2024 · 0 comments

Comments

@Oktopuce
Copy link

With TYPO3 V13, if you run the upgrade wizard, you have this exception if sql_mode=only_full_group_by.

#1055 Doctrine\DBAL\Exception\DriverException

An exception occurred while executing a query: Expression #6 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'uccife.sys_category_record_mm.sorting' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

You are getting this exception because you are trying to execute a query with a GROUP BY clause that does not contain all selected fields and sql_mode=only_full_group_by.

The exception is thrown in file RemoveDuplicateSysCategoryRecordMms, method updateNecessary():

$statement = $queryBuilder->count('*')
  ->addSelect('uid_local', 'uid_foreign', 'tablenames', 'fieldname', 'sorting', 'sorting_foreign')
  ->from('sys_category_record_mm')
  ->groupBy('uid_local', 'uid_foreign', 'tablenames', 'fieldname')
  ->having('COUNT(*) > 1')
  ->executeQuery();

the request must be changed like this:

$statement = $queryBuilder->count('*')
  ->addSelect('uid_local', 'uid_foreign', 'tablenames', 'fieldname', 'sorting', 'sorting_foreign')
  ->from('sys_category_record_mm')
  ->groupBy('uid_local', 'uid_foreign', 'tablenames', 'fieldname', 'sorting', 'sorting_foreign')
  ->having('COUNT(*) > 1')
  ->executeQuery();

This must also be changed in method executeUpdate().

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

No branches or pull requests

1 participant