Error Occurs When Running the Same SQL on Two Clusters with the Same Version

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 在两个同版本集群上运行同样的sql有报错

| username: qufudcj

[TiDB Usage Environment] Production Environment / Testing
[TiDB Version] v4.0.4
[Reproduction Path] What operations were performed to encounter the issue
[Encountered Issue: Issue Phenomenon and Impact]
The old TiDB was set up three years ago with version v4.0.4. The new cluster was created a few days ago with version v4.0.16. It was found that when executing a group by statement, if the field name following “by” is not exactly the same as the field in the select statement, an error occurs. Therefore, the v4.0.16 version was deleted, and a new v4.0.4 cluster was created using the original resources.
However, the newly created v4.0.4 cluster still reports an error, while the old v4.0.4 cluster does not. I am not sure if there is some configuration that was not adjusted.

Or is it that when I rebuilt v4.0.4, some configuration from the v4.0.16 version was not completely deleted? Or is it that the tiup version I used during installation is too high?

[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]
Execution failure in the new cluster


Successful execution in the old cluster

| username: realcp1018 | Original post link

There is a prompt: only_full_group_by in sql_mode affects the behavior of group.

| username: qufudcj | Original post link

Thank you, I asked a basic question. I was busy comparing the configurations of the two databases and didn’t compare the system variables.