Redshift Keyword Compatibility Reference¶
Generated for GSP Java version 4.1.0.8 on 2026-03-15
This page was generated using hybrid static extraction from parser source files combined with runtime validation against the actual GSP parser. Re-run the extraction script after parser updates to keep this page current.
AWS Compatibility¶
As of version 4.1.0.8, the GSP Redshift parser allows all keywords that AWS Redshift allows as unquoted column names. There are no gaps between GSP and AWS behavior for column-name usage.
The following 6 keywords were previously restricted but have been fixed using lexer lookahead disambiguation:
| Keyword | Previous Status | Fix Applied |
|---|---|---|
LISTAGG |
Blocked | Added to keyword_canbe_column_name; function syntax disambiguated by ( |
CONVERT |
Context-specific | Moved to keyword_canbe_column_name; function syntax disambiguated by ( |
APPROXIMATE |
Context-specific | Lexer lookahead converts to prefix token when followed by expression |
CONNECT_BY_ROOT |
Context-specific | Lexer lookahead converts to prefix token when followed by expression |
CHARACTER |
Context-specific | Lexer lookahead converts to type token when followed by VARYING, SET, or ( |
DOUBLE |
Context-specific | Lexer lookahead converts to type token when followed by PRECISION |
All 6 keywords now work correctly in both contexts:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Full Classification Overview¶
Out of 488 keywords recognized by the GSP Redshift parser:
| Classification | Count | Description |
|---|---|---|
| Allowed | 463 | Can be used as an unquoted column name in both canonical contexts |
| Context-specific | 24 | Fails as SELECT keyword FROM t but works as SELECT t.keyword FROM t |
| Blocked | 1 | Cannot be used as an unquoted column name in either context |
All 24 context-specific and 1 blocked keywords are also reserved by AWS Redshift — so they would cause issues in AWS Redshift as well. There is no gap between GSP and AWS behavior.
Context-Specific Keywords (Full List)¶
These keywords fail when used as bare column names (SELECT keyword FROM t) but succeed when table-qualified (SELECT t.keyword FROM t).
| Keyword | Also Reserved by AWS? | Reason |
|---|---|---|
ALL |
Yes | SELECT qualifier (SELECT ALL) |
ARRAY |
Yes | Type/expression keyword |
AUTHORIZATION |
Yes | Privilege keyword |
BINARY |
Yes | Type keyword |
CASE |
Yes | Starts CASE expression |
CAST |
Yes | Starts CAST expression |
CROSS |
Yes | JOIN keyword |
DISTINCT |
Yes | SELECT qualifier |
FREEZE |
Yes | Join keyword |
FULL |
Yes | JOIN keyword |
ILIKE |
Yes | Operator keyword |
INNER |
Yes | JOIN keyword |
INTO |
Yes | SELECT INTO keyword |
IS |
Yes | Operator keyword |
JOIN |
Yes | JOIN keyword |
LEFT |
Yes | JOIN keyword |
LIKE |
Yes | Operator keyword |
NATURAL |
Yes | JOIN keyword |
OUTER |
Yes | JOIN keyword |
OVERLAPS |
Yes | Operator keyword |
RIGHT |
Yes | JOIN keyword |
SIMILAR |
Yes | Operator keyword |
TOP |
Yes | SELECT TOP N clause |
VERBOSE |
Yes | Modifier keyword |
Blocked Keywords (Full List)¶
| Keyword | Also Reserved by AWS? | Workaround |
|---|---|---|
FROM |
Yes | SELECT "FROM" FROM t |
The POSITION Keyword¶
The POSITION keyword is a notable dual-use case. Following a customer-reported bug (MantisBT #4360), it was moved from collabel_reserved_keyword to keyword_canbe_column_name, allowing it to function both as:
- A column name:
SELECT position FROM t - A function:
SELECT POSITION('a' IN 'abc') FROM t
Both uses parse correctly in the current version. The same lexer lookahead pattern was used to fix the 6 keywords listed above.
Workaround: Double-Quoted Identifiers¶
For any keyword that fails as an unquoted column name, you can use double-quoted identifiers:
1 2 3 4 5 6 7 8 9 10 11 12 | |
Double-quoted identifiers have been verified to work for all blocked and context-specific keywords listed on this page.
Scope and Limitations¶
- Tested contexts:
SELECT keyword FROM tandSELECT t.keyword FROM t. Other contexts (DDL column definitions, INSERT column lists, aliases) may behave differently. - Version-specific: This report reflects GSP Java version 4.1.0.8.
- AWS comparison: Based on the AWS Redshift reserved words list dated 2023-05-08. AWS may have updated their list since.
- Case sensitivity: Keywords are case-insensitive.
select,SELECT, andSelectare all treated the same.
How to Report Discrepancies¶
If you encounter a keyword that behaves differently from what this page describes, please report it through your support channel. Include:
- The exact SQL statement
- The GSP parser version
- Whether the same SQL works in Amazon Redshift
Methodology¶
- Static extraction: A Python script parses the lexer (
.cod) and grammar (.y) source files to identify all 488 keywords and their grammar classifications. - Runtime validation: A Java test harness validates every classification against actual
TGSqlParserruntime behavior. - AWS comparison: The runtime-verified GSP classifications are compared against the AWS Redshift reserved words list to identify gaps.
- JSON dataset: The authoritative data is stored in
docs/generated/redshift_keyword_compatibility.json.