Skip to content

Commit

Permalink
Add Snowflake Reserved Words to Extension file (#2444)
Browse files Browse the repository at this point in the history
* Add Snowflake Reserved Words to Extension file 

snowflake reserved words

* Update postgresExtension.pure

* Update snowflakeExtension.pure

* Update TestSnowflakeExplodeSemiStructured.java

* Update legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres/relational/sqlQueryToString/postgresExtension.pure

---------

Co-authored-by: Andrew Ormerod <[email protected]>
  • Loading branch information
sprisha and aormerod-gs authored Nov 10, 2023
1 parent 0c8adb8 commit fc4c7f5
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function <<access.private>> meta::relational::functions::sqlQueryToString::postg

^DbExtension(
isBooleanLiteralSupported = true,
isDbReservedIdentifier = {str:String[1]| $str->in($reservedWords)},
isDbReservedIdentifier = {str:String[1]| $str->toLower()->in($reservedWords)},
literalProcessor = $literalProcessor,
joinStringsProcessor = processJoinStringsOperationForPostgres_JoinStrings_1__SqlGenerationContext_1__String_1_,
selectSQLQueryProcessor = processSelectSQLQueryForPostgres_SelectSQLQuery_1__SqlGenerationContext_1__Boolean_1__String_1_,
Expand All @@ -36,7 +36,110 @@ function <<access.private>> meta::relational::functions::sqlQueryToString::postg

function <<access.private>> meta::relational::functions::sqlQueryToString::postgres::postgresReservedWords():String[*]
{
[];
// https://www.postgresql.org/docs/current/sql-keywords-appendix.html
[
'all',
'analyse',
'analyze',
'and',
'any',
'array',
'as',
'asc',
'asymmetric',
'authorization',
'binary',
'both',
'case',
'cast',
'check',
'collate',
'collation',
'column',
'concurrently',
'constraint',
'create',
'cross',
'current_catalog',
'current_date',
'current_role',
'current_schema',
'current_time',
'current_timestamp',
'current_user',
'default',
'deferrable',
'desc',
'distinct',
'do',
'else',
'end',
'except',
'false',
'fetch',
'for',
'foreign',
'freeze',
'from',
'full',
'grant',
'group',
'having',
'ilike',
'in',
'initially',
'inner',
'intersect',
'into',
'is',
'isnull',
'join',
'lateral',
'leading',
'left',
'like',
'limit',
'localtime',
'localtimestamp',
'natural',
'not',
'notnull',
'null',
'offset',
'on',
'only',
'or',
'order',
'outer',
'overlaps',
'placing',
'primary',
'references',
'returning',
'right',
'select',
'session_user',
'similar',
'some',
'symmetric',
'system_user',
'table',
'tablesample',
'then',
'to',
'trailing',
'true',
'union',
'unique',
'user',
'using',
'variadic',
'verbose',
'when',
'where',
'window',
'with'
];
}

function <<access.private>> meta::relational::functions::sqlQueryToString::postgres::getLiteralProcessorsForPostgres():Map<Type,LiteralProcessor>[1]
Expand Down
Loading

0 comments on commit fc4c7f5

Please sign in to comment.