Add support for UNION DISTINCT BY NAME syntax (#997)

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
Alexander Beedie 2023-10-24 01:37:31 +04:00 committed by GitHub
parent c03586b727
commit 5c10668dbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 89 additions and 152 deletions

View file

@ -5696,7 +5696,9 @@ impl<'a> Parser<'a> {
pub fn parse_set_quantifier(&mut self, op: &Option<SetOperator>) -> SetQuantifier {
match op {
Some(SetOperator::Union) => {
if self.parse_keywords(&[Keyword::BY, Keyword::NAME]) {
if self.parse_keywords(&[Keyword::DISTINCT, Keyword::BY, Keyword::NAME]) {
SetQuantifier::DistinctByName
} else if self.parse_keywords(&[Keyword::BY, Keyword::NAME]) {
SetQuantifier::ByName
} else if self.parse_keyword(Keyword::ALL) {
if self.parse_keywords(&[Keyword::BY, Keyword::NAME]) {