Implement is [not] distinct from (#361)

* Implement is [not] distinct from

* Simplify message

* Clippy
This commit is contained in:
Daniël Heres 2021-10-14 18:26:28 +02:00 committed by GitHub
parent c9f8a44b55
commit 0f0b327e97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 7 deletions

View file

@ -917,8 +917,18 @@ impl<'a> Parser<'a> {
Ok(Expr::IsNull(Box::new(expr)))
} else if self.parse_keywords(&[Keyword::NOT, Keyword::NULL]) {
Ok(Expr::IsNotNull(Box::new(expr)))
} else if self.parse_keywords(&[Keyword::DISTINCT, Keyword::FROM]) {
let expr2 = self.parse_expr()?;
Ok(Expr::IsDistinctFrom(Box::new(expr), Box::new(expr2)))
} else if self.parse_keywords(&[Keyword::NOT, Keyword::DISTINCT, Keyword::FROM])
{
let expr2 = self.parse_expr()?;
Ok(Expr::IsNotDistinctFrom(Box::new(expr), Box::new(expr2)))
} else {
self.expected("NULL or NOT NULL after IS", self.peek_token())
self.expected(
"[NOT] NULL or [NOT] DISTINCT FROM after IS",
self.peek_token(),
)
}
}
Keyword::NOT | Keyword::IN | Keyword::BETWEEN => {