Skip to content

Commit

Permalink
corrected comma list to partition by
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Apr 18, 2013
1 parent b3a6354 commit 5d40d7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/javacc/net/sf/jsqlparser/parser/JSqlParserCC.jj
Original file line number Diff line number Diff line change
Expand Up @@ -1531,7 +1531,7 @@ AnalyticExpression AnalyticExpression() :
}
{
token=<S_IDENTIFIER> { retval.setName(token.image); } "(" [ expr=SimpleExpression() | "*" { retval.setAllColumns(true); } ] ")" <K_OVER> "("
[<K_PARTITION> <K_BY> (column=Column() {plist.add(column);} )+ ]
[<K_PARTITION> <K_BY> column=Column() {plist.add(column);} ("," column=Column() {plist.add(column);} )* ]
[olist=OrderByElements() ]
{
retval.setExpression(expr);
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/net/sf/jsqlparser/test/select/SelectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ public void testProblemSqlAnalytic8Complex() throws JSQLParserException {
String stmt = "SELECT ID, NAME, SALARY, SUM(SALARY) OVER () AS SUM_SAL, AVG(SALARY) OVER () AS AVG_SAL, MIN(SALARY) OVER () AS MIN_SAL, MAX(SALARY) OVER () AS MAX_SAL, COUNT(*) OVER () AS ROWS FROM STAFF WHERE ID < 60 ORDER BY ID";
assertSqlCanBeParsedAndDeparsed(stmt);
}

public void testProblemSqlAnalytic9CommaListPartition() throws JSQLParserException {
String stmt = "SELECT a, row_number() OVER (PARTITION BY c, d ORDER BY a, b) AS n FROM table1";
assertSqlCanBeParsedAndDeparsed(stmt);
}

public void testOracleJoin() throws JSQLParserException {
String stmt = "SELECT * FROM tabelle1, tabelle2 WHERE tabelle1.a = tabelle2.b(+)";
Expand Down

0 comments on commit 5d40d7f

Please sign in to comment.