diff --git a/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt b/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt index e446a5caf..2b21a3eea 100644 --- a/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt +++ b/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt @@ -3895,6 +3895,7 @@ Expression BitwiseXor(): } Expression ArrayExpression(Expression obj): { + Expression expr; Expression idxExpr = null; Expression startExpr = null; Expression stopExpr = null; @@ -3906,7 +3907,18 @@ Expression ArrayExpression(Expression obj): { [stopExpr = SimpleExpression()] ] "]" - { return new ArrayExpression(obj, idxExpr, startExpr, stopExpr); } + { expr = new ArrayExpression(obj, idxExpr, startExpr, stopExpr); } + ( + "[" + [LOOKAHEAD(3) idxExpr = SimpleExpression()] + [ + (":" { startExpr=idxExpr; idxExpr=null; }) + [stopExpr = SimpleExpression()] + ] + "]" + { expr = new ArrayExpression(expr, idxExpr, startExpr, stopExpr); } + )* + { return expr; } } Expression PrimaryExpression() #PrimaryExpression: diff --git a/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java b/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java index efac92ff3..dd7090fc3 100644 --- a/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java +++ b/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java @@ -5294,4 +5294,9 @@ public void testSelectStatementWithoutForUpdateAndSkipLockedTokens() throws JSQL assertFalse(plainSelect.isForUpdate()); assertFalse(plainSelect.isSkipLocked()); } + + @Test + public void testSelectMultidimensionalArrayStatement() throws JSQLParserException { + assertSqlCanBeParsedAndDeparsed("SELECT f1, f2[1][1], f3[1][2][3] FROM test"); + } }