File tree Expand file tree Collapse file tree
main/jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/statement Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1287,6 +1287,7 @@ String NonReservedWord() :
12871287 | tk=<K_FULLTEXT:"FULLTEXT">
12881288 | tk=<K_FUNCTION:"FUNCTION">
12891289 | tk=<K_GRANT:"GRANT">
1290+ | tk=<K_GROUPS:"GROUPS">
12901291 | tk=<K_GROUP_CONCAT:"GROUP_CONCAT">
12911292 | tk=<K_GUARD:"GUARD">
12921293 | tk=<K_HASH:"HASH">
@@ -1577,7 +1578,6 @@ TOKEN: /* Reserved SQL Keywords and structural tokens */
15771578| <K_GLOBAL:"GLOBAL">
15781579| <K_GROUP:"GROUP">
15791580| <K_GROUPING:"GROUPING">
1580- | <K_GROUPS:"GROUPS">
15811581| <K_HAVING:"HAVING">
15821582| <K_IF:"IF">
15831583| <K_IIF:"IIF">
Original file line number Diff line number Diff line change @@ -51,4 +51,15 @@ public void testCombinedTokenKeywords() throws JSQLParserException {
5151 String sqlStr = "SELECT current_date(3)" ;
5252 assertSqlCanBeParsedAndDeparsed (sqlStr , true );
5353 }
54+
55+ // #2473: GROUPS is a non-reserved keyword in PostgreSQL and must stay usable as an
56+ // identifier, although it also introduces the GROUPS window frame unit.
57+ @ Test
58+ public void testGroupsAsIdentifier () throws JSQLParserException {
59+ assertSqlCanBeParsedAndDeparsed ("SELECT groups FROM mytable" , true );
60+ assertSqlCanBeParsedAndDeparsed ("SELECT * FROM groups" , true );
61+ assertSqlCanBeParsedAndDeparsed ("SELECT a AS groups FROM mytable" , true );
62+ assertSqlCanBeParsedAndDeparsed ("SELECT a groups FROM mytable" , true );
63+ assertSqlCanBeParsedAndDeparsed ("CREATE TABLE mytable (groups INT)" , true );
64+ }
5465}
You can’t perform that action at this time.
0 commit comments