You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] JSQLParser 5.4-SNAPSHOT : PostgreSQL : GROUPS cannot be used as an identifier anymore (regression via #2460) #2473
GROUPS cannot be used as an identifier (column, table, or alias) anymore.
The GROUPS keyword was introduced for PostgreSQL GROUPS window frames in d92f407 (#2460) and was placed into the reserved keyword token section of the grammar. However, GROUPS is a non-reserved keyword in PostgreSQL (see the key words table: GROUPS is marked "non-reserved"), so it remains a perfectly legal identifier.
As a result, SQL which parsed fine before #2460 now fails on current master.
SQL Example:
SELECT groups FROM mytable;
SELECT*FROM groups;
SELECT a AS groups FROM mytable;
SELECT a groups FROM mytable;
CREATETABLEt (groups INT);
Each statement throws a JSQLParserException (e.g. Encountered unexpected token: "groups").
The grammar already has the right mechanism for such keywords: tokens declared inside the NonReservedWord() production are automatically accepted as identifiers via the MIN_NON_RESERVED_WORD / MAX_NON_RESERVED_WORD range guards (used by RelObjectName() and isAliasAhead()), and KeywordsTest covers every one of them parameterized as identifiers. GROUPS just needs to move from the reserved token section into NonReservedWord().
Activity
fix: allow GROUPS as identifier by making it a non-reserved keyword (#…