terrymanu commented on issue #26338:
URL: 
https://github.com/apache/shardingsphere/issues/26338#issuecomment-3538689904

   This is not a ShardingSphere bug, but rather a compatibility issue between 
MySQL Connector version and database configuration.
   
     Analysis Conclusion
   
     1. No GROUP BY TABLE_TYPE Issue in ShardingSphere Code
   
     After a comprehensive code search, I confirm:
     - TABLE_TYPE in ShardingSphere code is only used as a table type filtering 
parameter for JDBC getTables() method
     - ShardingSphere does not generate any SQL statements containing "GROUP BY 
TABLE_TYPE"
     - ShardingSphere only transparently forwards JDBC metadata queries
   
     2. Root Cause of the Problem
   
     This SQL is generated by ORM frameworks (such as Spring JPA/Hibernate), 
ShardingSphere is responsible for transparent forwarding, and the database 
reports the error directly.
   
     The complete error chain:
     1. Spring JPA startup calls connection.getMetaData().getTables()
     2. MySQL Connector 8.x internally generates complex metadata queries 
containing GROUP BY
     3. ShardingSphere, as a transparent proxy, directly forwards this SQL to 
the database
     4. The database receives the SQL and detects a violation of functional 
dependency rules in ONLY_FULL_GROUP_BY mode
     5. The database directly reports the error: "Expression 'TABLE_TYPE' is 
not being grouped"
   
     3. MySQL Version Differences Clarification
   
     - Both MySQL 5.7 and 8.0 have ONLY_FULL_GROUP_BY enabled by default in 
sql_mode
     - The behavior is consistent between these two versions
     - The issue is not related to differences in default values between MySQL 
versions
   
     Solution
   
     Check the database's sql_mode setting to ensure compatibility with the 
application:
   
     -- Check current sql_mode
     SELECT @@sql_mode;
   
     -- Adjust configuration as needed
   
     This is not a bug that ShardingSphere needs to fix, but rather a 
compatibility issue with SQL generated by ORM under specific database 
configurations. ShardingSphere simply performs correct transparent forwarding.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to