Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JSQLParser/JSqlParser
Browse files Browse the repository at this point in the history
  • Loading branch information
manticore-projects committed Jun 29, 2024
2 parents 6fd842b + fc90c0b commit 0e1ff56
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -4619,15 +4619,16 @@ JdbcNamedParameter JdbcNamedParameter() : {
}

OracleNamedFunctionParameter OracleNamedFunctionParameter() : {
String name;
Token token = null;
String name = null;
Expression expression;
}
{
name=RelObjectNameExt2()
( name=RelObjectNameExt2() | token=<K_OUTER> )
<K_ORACLE_NAMED_PARAMETER_ASSIGNMENT>
expression=Expression()
{
return new OracleNamedFunctionParameter(name, expression);
return new OracleNamedFunctionParameter(name != null ? name : token.image, expression);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,20 @@ void testLateralFlat() throws JSQLParserException {
TestUtils.assertSqlCanBeParsedAndDeparsed(sqlStr, true);
}

/**
* The SQL keyword "OUTER" is a valid parameter name for Snowflake's FLATTEN table function.
*/
@Test
void testTableFunctionWithNamedParameterWhereNameIsOuterKeyword() throws JSQLParserException {
String sqlStr =
"INSERT INTO db.schema.target\n" +
" (Name, FriendParent)\n" +
" SELECT\n" +
" i.DATA_VALUE:Name AS Name,\n" +
" f1.Value:Parent:Name AS FriendParent\n" +
" FROM\n" +
" db.schema.source AS i,\n" +
" lateral flatten(input => i.DATA_VALUE:Friends, outer => true) AS f1;";
TestUtils.assertSqlCanBeParsedAndDeparsed(sqlStr, true);
}
}

0 comments on commit 0e1ff56

Please sign in to comment.