Skip to content

fix MySQLSchemaTool FK introspection under ONLY_FULL_GROUP_BY - #688

Merged
ilvalerione merged 1 commit into
neuron-core:4.xfrom
cironapo:fix/mysql-schema-tool-distinct-order-by
Oct 12, 2026
Merged

ilvalerione merged 1 commit into
neuron-core:4.xfrom
cironapo:fix/mysql-schema-tool-distinct-order-by

Conversation

@cironapo

Copy link
Copy Markdown
Contributor

Type of Change

  • 🐛 Bug fix

Description

What does this PR do?

Includes kcu.ORDINAL_POSITION in the SELECT DISTINCT list of MySQLSchemaTool::getRelationships().

Why is this change needed?

MySQL/MariaDB with ONLY_FULL_GROUP_BY reject DISTINCT + ORDER BY on columns not in the SELECT list (error 3065), so analyze_mysql_database_schema crashes before returning schema.

How does this change should be used and documented?

No API/docs changes. Existing MySQLSchemaTool usage keeps working.

Related Issues

Testing

  • I have tested this change locally
  • I have added/updated unit tests where appropriate
  • All existing tests pass
  • I have tested this with different PHP versions (if applicable)

Breaking Changes

  • No breaking changes

Documentation

  • No documentation changes needed

Checklist

  • My code follows the project's coding standards (PHPStan)
  • I have performed a self-review of my code
  • My changes generate no new warnings or errors
  • My commit messages are clear and descriptive
  • This PR addresses only ONE specific goal/issue

Include ORDINAL_POSITION in SELECT DISTINCT so MySQL/MariaDB accept ORDER BY under strict SQL mode.
@ilvalerione
ilvalerione merged commit b1b80c1 into neuron-core:4.x Oct 12, 2026
13 checks passed
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

Successfully merging this pull request may close these issues.

2 participants