bug fixed for sql parser. for issue #1789

This commit is contained in:
wenshao
2017-06-23 19:49:16 +08:00
parent 404166a565
commit 7bf323cd57
3 changed files with 97 additions and 1 deletions
@@ -1382,6 +1382,15 @@ public class SQLExprParser extends SQLParser {
SQLInListExpr inListExpr = new SQLInListExpr(expr);
if (lexer.token() == Token.LPAREN) {
lexer.nextToken();
if (lexer.token() == Token.WITH) {
SQLSelect select = this.createSelectParser().select();
SQLInSubQueryExpr queryExpr = new SQLInSubQueryExpr(select);
queryExpr.setExpr(expr);
accept(Token.RPAREN);
return queryExpr;
}
exprList(inListExpr.getTargetList(), inListExpr);
accept(Token.RPAREN);
expr = inListExpr;
@@ -2661,7 +2661,7 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
public boolean visit(SQLWithSubqueryClause x) {
print0(ucase ? "WITH " : "with ");
if (x.getRecursive() == Boolean.TRUE) {
print0(ucase ? "RECURSIVE " : " recursive ");
print0(ucase ? "RECURSIVE " : "recursive ");
}
incrementIndent();
printlnAndAccept(x.getEntries(), ", ");