aws / aws/amazon-redshift-jdbc-driver

Missing SQL keywords in `DatabaseMetaData.getSQLKeywords`

Open
#121 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
71
Forks
42
PR merge metrics
No merged PRs in 30d

Description

## Driver version
2.1.0.29

## Redshift version
PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.69945

## Client Operating System
macOS 14.5

## JAVA/JVM version
17.0.9

## Problem description
The method `DatabaseMetaData.getSQLKeywords` doesn't return all the reserved keywords for Redshift.
According to the JDBC spec this method should return:

> a comma-separated list of all of this database's SQL keywords that are NOT also SQL:2003 keywords.

The method, implemented in `com.amazon.redshift.jdbc.RedshiftDatabaseMetaData` returns the following list:

```
abort,access,aggregate,also,analyse,analyze,backward,bit,cache,checkpoint,class,
cluster,comment,concurrently,connection,conversion,copy,csv,database,delimiter,
delimiters,disable,do,enable,encoding,encrypted,exclusive,explain,force,forward,freeze,
greatest,handler,header,if,ilike,immutable,implicit,index,indexes,inherit,inherits,
instead,isnull,least,limit,listen,load,location,lock,mode,move,nothing,notify,notnull,
nowait,off,offset,oids,operator,owned,owner,password,prepared,procedural,quote,reassign,
recheck,reindex,rename,replace,reset,restrict,returning,rule,setof,share,show,stable,
statistics,stdin,stdout,storage,strict,sysid,tablespace,temp,template,truncate,trusted,
unencrypted,unlisten,until,vacuum,valid,validator,verbose,volatile
```

But the list doesn't contain all the reserved words specified in https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html

For example, `aes128` or `aes256` are not included, they are not part of SQL 2003 keywords, and they are reserved keywords, as they must be quoted.

## JDBC trace logs

## Reproduction code

Contributor guide

Open the contributing guide

Research direction

Start in com.amazon.redshift.jdbc.RedshiftDatabaseMetaData and inspect the implementation of getSQLKeywords and its current keyword list. Compare it with the Redshift reserved-keyword documentation, including aes128 and aes256, and verify that the returned value contains all reserved words that are not SQL:2003 keywords.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.