Skip to content

Bug Report: “Analyze Database Structure” fails with MySQL ONLY_FULL_GROUP_BY #27

Description

@NeoBlack

Bug: "Analyze Database Structure" fails with MySQL error #1055

Description

When running "Analyze Database Structure", the database comparison fails with a Doctrine DBAL / MySQL error.

The feature appears to compare the current database schema against the definitions provided by the loaded extensions (ext_tables.sql). However, the SQL query used during the analysis is not compatible with MySQL's ONLY_FULL_GROUP_BY mode.

Error Message

#1055 Doctrine\DBAL\Exception\DriverException

SQLSTATE[42000]: Syntax error or access violation: 1055
Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'naegler_hamburg.tx_aim_request_log.uid' which is not functionally dependent on columns in GROUP BY clause;

this is incompatible with sql_mode=only_full_group_by

Steps to Reproduce

  1. Open the backend.
  2. Open "Analyze Database Structure".
  3. Run the database structure analysis.
  4. The database comparison fails with the error above.

Expected Behavior

The database structure should be analyzed successfully and compared against the loaded extension definitions.

The analyzer should then display the required schema changes.

Actual Behavior

The database comparison fails before the analysis can be completed.

MySQL rejects the generated query because tx_aim_request_log.uid is included in the SELECT list but is neither included in the GROUP BY clause nor used within an aggregate function.

This occurs when MySQL is running with:

sql_mode=ONLY_FULL_GROUP_BY

Technical Details

Affected table:

tx_aim_request_log

Affected column:

uid

Exception location:

vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 102

The underlying query appears to contain a structure equivalent to:

SELECT uid, ...
FROM tx_aim_request_log
...
GROUP BY ...

where uid is not part of the GROUP BY clause.

Possible Fix

The generated SQL should be made compatible with MySQL's ONLY_FULL_GROUP_BY mode.

Depending on the purpose of the query, possible solutions include:

  • adding uid to the GROUP BY clause,
  • using an appropriate aggregate function for uid, or
  • restructuring the query so that the GROUP BY is no longer required.

Disabling ONLY_FULL_GROUP_BY would only work around the problem and should not be necessary for a correctly generated query.

Impact

Medium / High

The database structure analysis cannot be completed on a standard MySQL configuration with ONLY_FULL_GROUP_BY enabled.

Environment

  • Database: MySQL
  • SQL mode: ONLY_FULL_GROUP_BY
  • Database abstraction layer: Doctrine DBAL
  • Affected table: tx_aim_request_log

System Information

This is a short system overview. For advanced information please head to: Environment Module

  • TYPO3 Version: 14.3.6
  • Installation Method: Composer mode
  • Web Server: nginx/1.31.3
  • PHP Version: 8.5.8
  • Debugger: xdebug 3.5.3
  • Database (Default): MySQL 9.3.0
  • Application Context: Production

Screenshots

The attached screenshots show:

  1. The "Analyze Database Structure" dialog with the detected schema changes.
  2. The resulting Doctrine/MySQL #1055 exception.
Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions