mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #789 from 52Jolynn/fix_pg_parenthesized_bug
fix postgresql parenthesized bug
This commit is contained in:
@@ -22,6 +22,7 @@ import com.alibaba.druid.sql.ast.SQLSetQuantifier;
|
||||
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectQuery;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLTableSource;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.expr.PGParameter;
|
||||
import com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGFunctionTableSource;
|
||||
@@ -58,6 +59,18 @@ public class PGSelectParser extends SQLSelectParser {
|
||||
return queryRest(valuesQuery);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
|
||||
SQLSelectQuery select = query();
|
||||
if (select instanceof SQLSelectQueryBlock) {
|
||||
((SQLSelectQueryBlock) select).setParenthesized(true);
|
||||
}
|
||||
accept(Token.RPAREN);
|
||||
|
||||
return queryRest(select);
|
||||
}
|
||||
|
||||
PGSelectQueryBlock queryBlock = new PGSelectQueryBlock();
|
||||
|
||||
if (lexer.token() == Token.SELECT) {
|
||||
|
||||
Reference in New Issue
Block a user