[jOOQ/jOOQ#10679] Parser incorrectly parses IN predicate of degree > 1

with extra parentheses around SELECT subquery
This commit is contained in:
Lukas Eder 2020-09-23 21:13:57 +02:00
parent 3ec7707b7e
commit c3f8c3028e

View File

@ -5364,7 +5364,7 @@ final class ParserImpl implements Parser {
: left instanceof Field
? ((Field) left).in(EMPTY_FIELD)
: new RowInCondition((Row) left, new QueryPartList<>(), false);
else if (peekKeyword(ctx, "SELECT") || peekKeyword(ctx, "SEL") || peekKeyword(ctx, "WITH"))
else if (peekSelectOrWith(ctx, true))
result = not
? left instanceof Field
? ((Field) left).notIn(parseWithOrSelect(ctx, 1))
@ -5413,7 +5413,7 @@ final class ParserImpl implements Parser {
else if (left instanceof Field && (parseKeywordIf(ctx, "LIKE") || parseOperatorIf(ctx, "~~") || (notOp = parseOperatorIf(ctx, "!~~")))) {
if (parseKeywordIf(ctx, "ANY")) {
parse(ctx, '(');
if (peekKeyword(ctx, "SELECT") || peekKeyword(ctx, "SEL") || peekKeyword(ctx, "WITH")) {
if (peekSelectOrWith(ctx, true)) {
Select<?> select = parseWithOrSelect(ctx);
parse(ctx, ')');
LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(any(select)) : ((Field) left).like(any(select));
@ -5438,7 +5438,7 @@ final class ParserImpl implements Parser {
}
else if (parseKeywordIf(ctx, "ALL")) {
parse(ctx, '(');
if (peekKeyword(ctx, "SELECT") || peekKeyword(ctx, "SEL") || peekKeyword(ctx, "WITH")) {
if (peekSelectOrWith(ctx, true)) {
Select<?> select = parseWithOrSelect(ctx);
parse(ctx, ')');
LikeEscapeStep result = (not ^ notOp) ? ((Field) left).notLike(all(select)) : ((Field) left).like(all(select));