Add support for parenthesized subquery as IN predicate (#1793)

This commit is contained in:
Adam Johnson 2025-04-15 18:01:18 +01:00 committed by GitHub
parent 514d2ecdaf
commit 3ad13af563
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 10 deletions

View file

@ -3756,15 +3756,13 @@ impl<'a> Parser<'a> {
});
}
self.expect_token(&Token::LParen)?;
let in_op = if self.parse_keyword(Keyword::SELECT) || self.parse_keyword(Keyword::WITH) {
self.prev_token();
Expr::InSubquery {
let in_op = match self.maybe_parse(|p| p.parse_query_body(p.dialect.prec_unknown()))? {
Some(subquery) => Expr::InSubquery {
expr: Box::new(expr),
subquery: self.parse_query()?,
subquery,
negated,
}
} else {
Expr::InList {
},
None => Expr::InList {
expr: Box::new(expr),
list: if self.dialect.supports_in_empty_list() {
self.parse_comma_separated0(Parser::parse_expr, Token::RParen)?
@ -3772,7 +3770,7 @@ impl<'a> Parser<'a> {
self.parse_comma_separated(Parser::parse_expr)?
},
negated,
}
},
};
self.expect_token(&Token::RParen)?;
Ok(in_op)