grammars-v4
grammars-v4 copied to clipboard
[sql/mysql/Positive-Technologies] `subqueryComparisonPredicate` Problem
trafficstars
predicate
: predicate NOT? IN '(' (selectStatement | expressions) ')' #inPredicate
| predicate IS nullNotnull #isNullPredicate
| left=predicate comparisonOperator right=predicate #binaryComparisonPredicate
| predicate comparisonOperator
quantifier=(ALL | ANY | SOME) '(' selectStatement ')' #subqueryComparisonPredicate
| predicate NOT? BETWEEN predicate AND predicate #betweenPredicate
| predicate SOUNDS LIKE predicate #soundsLikePredicate
| predicate NOT? LIKE predicate (ESCAPE STRING_LITERAL)? #likePredicate
| predicate NOT? regex=(REGEXP | RLIKE) predicate #regexpPredicate
| (LOCAL_ID VAR_ASSIGN)? expressionAtom #expressionAtomPredicate
| predicate MEMBER OF '(' predicate ')' #jsonMemberOfPredicate
;
[Description]
Simple test
SELECT * FROM T WHERE X > ALL (SELECT 1);
SELECT * FROM T WHERE X > ANY (SELECT 1);
SELECT * FROM T WHERE X > SOME (SELECT 1);
The ALL is fine, but the SOME ANY is recognized as fullColumnName.
The full Parse Tree below
Have you tried to swap left=predicate comparisonOperator right=predicate and predicate comparisonOperator quantifier=(ALL | ANY | SOME) '(' selectStatement ')' ?
Have you tried to swap
left=predicate comparisonOperator right=predicateandpredicate comparisonOperator quantifier=(ALL | ANY | SOME) '(' selectStatement ')'?
The problem persists after I tried.