Bug #93382 can not select if field named "groups"
Submitted: 28 Nov 2018 9:57 Modified: 28 Nov 2018 10:33
Reporter: van Y Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[28 Nov 2018 9:57] van Y
Description:
when execute the sql like "select groups from tab"----the field is named "groups",a 

error will happen:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups
    from tab'

How to repeat:
a
[28 Nov 2018 10:33] MySQL Verification Team
https://dev.mysql.com/doc/refman/8.0/en/keywords.html
...
GROUPS (R); added in 8.0.2 (reserved)
...

Use backticks instead..

mysql> create table tab(`groups` int)engine=innodb;
Query OK, 0 rows affected (0.05 sec)

mysql> insert into tab set `groups`=1;
Query OK, 1 row affected (0.05 sec)

mysql> select `groups` from tab;
+--------+
| groups |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)