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

Unmatched error code with MySQL for a same error (only_full_group_by) #22694

Open
zhangysh1995 opened this issue Feb 3, 2021 · 3 comments · May be fixed by #22722
Open

Unmatched error code with MySQL for a same error (only_full_group_by) #22694

zhangysh1995 opened this issue Feb 3, 2021 · 3 comments · May be fixed by #22722
Assignees
Labels
feature/developing the related feature is in development severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@zhangysh1995
Copy link

Bug Report

1. Minimal reproduce step (Required)

create table table_5_utf8_6 (
`pk` int primary key,
`col_double_key_signed` double  ,
key (`col_double_key_signed`)
) character set utf8
partition by hash(pk)
partitions 6;

2. What did you expect to see? (Required)

mysql> SELECT ALL `col_double_key_signed` FROM table_5_utf8_6 HAVING ( CAST( ( COUNT( BINARY -3688098003402515037 ) ) AS TIME ) )  FOR UPDATE;
ERROR 1140 (42000): In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'test.table_5_utf8_6.col_double_key_signed'; this is incompatible with sql_mode=only_full_group_by

3. What did you see instead (Required)

mysql> SELECT ALL `col_double_key_signed` FROM table_5_utf8_6 HAVING ( CAST( ( COUNT( BINARY -3688098003402515037 ) ) AS TIME ) )  FOR UPDATE;
ERROR 8123 (HY000): In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'col_double_key_signed'; this is incompatible with sql_mode=only_full_group_by

We have the following in the error code documentation:

Error codes
TiDB is compatible with the error codes in MySQL, and in most cases returns the same error code as MySQL. For a list of error codes for MySQL, see Server Error Message Reference. In addition, TiDB has the following unique error codes

Error Number: 8123

An SQL query with aggregate functions returns non-aggregated columns, which violates the only_full_group_by mode.

Modify the SQL statement or disable the only_full_group_by mode

However, for this query, two systems report the same error but give different error codes.

4. What is your TiDB version? (Required)

-----------------------------------+
| Release Version: v5.0.0-rc
Edition: Community
Git Commit Hash: fd4437dde445012f5b75e5d4f336433cb076c1ee
Git Branch: heads/refs/tags/v5.0.0-rc
UTC Build Time: 2021-01-12 06:00:03
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@zhangysh1995 zhangysh1995 added the type/bug The issue is confirmed as a bug. label Feb 3, 2021
@xuyifangreeneyes
Copy link
Contributor

/assign

@mjonss
Copy link
Contributor

mjonss commented Feb 14, 2022

Does not need a partitioned table to reproduce.

@AilinKid
Copy link
Contributor

wait for #22722 to resolve the error code difference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/developing the related feature is in development severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
8 participants