amazon-redshift-jdbc-driver icon indicating copy to clipboard operation
amazon-redshift-jdbc-driver copied to clipboard

Missing SQL keywords in `DatabaseMetaData.getSQLKeywords`

Open antonireus opened this issue 1 year ago • 0 comments

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

antonireus avatar Jul 02 '24 12:07 antonireus