Skip to content

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
-- As column names (previously failed)
SELECT listagg FROM t;
SELECT convert FROM t;
SELECT approximate FROM t;
SELECT connect_by_root FROM t;
SELECT character FROM t;
SELECT double FROM t;

-- Original syntax (still works)
SELECT LISTAGG(col, ',') WITHIN GROUP (ORDER BY col) FROM t;
SELECT CONVERT(VARCHAR, col) FROM t;
SELECT APPROXIMATE COUNT(DISTINCT col) FROM t;
SELECT CONNECT_BY_ROOT col FROM t;
CREATE TABLE t(c CHARACTER VARYING(100));
CREATE TABLE t(c DOUBLE PRECISION);

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
-- Blocked keyword as column name: fails
SELECT from FROM t;

-- Workaround: quote the identifier
SELECT "from" FROM t;

-- Context-specific keyword: fails unqualified
SELECT cast FROM t;

-- Workarounds
SELECT t.cast FROM t;  -- table-qualified
SELECT "cast" FROM t;  -- double-quoted

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 t and SELECT 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, and Select are 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:

  1. The exact SQL statement
  2. The GSP parser version
  3. Whether the same SQL works in Amazon Redshift

Methodology

  1. Static extraction: A Python script parses the lexer (.cod) and grammar (.y) source files to identify all 488 keywords and their grammar classifications.
  2. Runtime validation: A Java test harness validates every classification against actual TGSqlParser runtime behavior.
  3. AWS comparison: The runtime-verified GSP classifications are compared against the AWS Redshift reserved words list to identify gaps.
  4. JSON dataset: The authoritative data is stored in docs/generated/redshift_keyword_compatibility.json.