Skip to content

Commit 4e87dd6

Browse files
authored
Fixed issue with parsing character varying, fixed issue with parsing null casted to some type, fixed issue with parsing DISTINCT in function call (#1)
* Fixed issue with parsing character varying, fixed issue with parsing null casted to some type, fixed issue with parsing DISTINCT in function call * Fixed parsing of DISTINCT ON statements * Fixed possible issue with parentheses * Updated version of module
1 parent 6cc0325 commit 4e87dd6

8 files changed

Lines changed: 4522 additions & 3405 deletions

File tree

grammars/SQLSelectParser.g4

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ selectStatement:
2020
selectStatementWithInto:
2121
OPEN_PAR_SYMBOL selectStatementWithInto CLOSE_PAR_SYMBOL
2222
| queryExpression intoClause lockingClauseList?
23-
| lockingClauseList intoClause
23+
| lockingClauseList intoClause
2424
;
2525

2626
queryExpression:
@@ -65,6 +65,7 @@ subquery:
6565

6666
querySpecOption:
6767
ALL_SYMBOL
68+
| DISTINCT_SYMBOL ON_SYMBOL OPEN_PAR_SYMBOL qualifiedIdentifier CLOSE_PAR_SYMBOL
6869
| DISTINCT_SYMBOL
6970
| STRAIGHT_JOIN_SYMBOL
7071
| HIGH_PRIORITY_SYMBOL
@@ -711,7 +712,7 @@ substringFunction:
711712
;
712713

713714
functionCall:
714-
pureIdentifier OPEN_PAR_SYMBOL udfExprList? CLOSE_PAR_SYMBOL // For both UDF + other functions.
715+
pureIdentifier OPEN_PAR_SYMBOL udfExprList? CLOSE_PAR_SYMBOL // For both UDF + other functions.
715716
| qualifiedIdentifier OPEN_PAR_SYMBOL exprList? CLOSE_PAR_SYMBOL // Other functions only.
716717
;
717718

@@ -720,7 +721,7 @@ udfExprList:
720721
;
721722

722723
udfExpr:
723-
expr selectAlias?
724+
expr qualifiedIdentifier? selectAlias?
724725
;
725726

726727
variable:
@@ -837,7 +838,8 @@ dataType:
837838
| (BOOL_SYMBOL | BOOLEAN_SYMBOL)
838839
| nchar fieldLength? BINARY_SYMBOL?
839840
| BINARY_SYMBOL fieldLength?
840-
| (VARCHAR_SYMBOL | VARCHAR2_SYMBOL | CHAR_SYMBOL | CHAR_SYMBOL VARYING_SYMBOL | STRING_SYMBOL | TEXT_SYMBOL) fieldLength charsetWithOptBinary?
841+
| CHAR_SYMBOL VARYING_SYMBOL
842+
| (VARCHAR_SYMBOL | VARCHAR2_SYMBOL | CHAR_SYMBOL | STRING_SYMBOL | TEXT_SYMBOL) fieldLength charsetWithOptBinary?
841843
| (
842844
NATIONAL_SYMBOL VARCHAR_SYMBOL
843845
| NVARCHAR2_SYMBOL

0 commit comments

Comments
 (0)