Enable custom dialects to support MATCH() AGAINST() (#1719)

This commit is contained in:
Justin Joyce 2025-02-10 05:51:22 +00:00 committed by GitHub
parent 46cfcfe8f7
commit 322209a9f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 1 deletions

View file

@ -147,4 +147,8 @@ impl Dialect for GenericDialect {
fn supports_array_typedef_size(&self) -> bool {
true
}
fn supports_match_against(&self) -> bool {
true
}
}

View file

@ -479,6 +479,11 @@ pub trait Dialect: Debug + Any {
false
}
/// Does the dialect support the `MATCH() AGAINST()` syntax?
fn supports_match_against(&self) -> bool {
false
}
/// Dialect-specific infix parser override
///
/// This method is called to parse the next infix expression.

View file

@ -129,6 +129,10 @@ impl Dialect for MySqlDialect {
fn requires_single_line_comment_whitespace(&self) -> bool {
true
}
fn supports_match_against(&self) -> bool {
true
}
}
/// `LOCK TABLES`

View file

@ -1198,7 +1198,7 @@ impl<'a> Parser<'a> {
})))
}
Keyword::NOT => Ok(Some(self.parse_not()?)),
Keyword::MATCH if dialect_of!(self is MySqlDialect | GenericDialect) => {
Keyword::MATCH if self.dialect.supports_match_against() => {
Ok(Some(self.parse_match_against()?))
}
Keyword::STRUCT if self.dialect.supports_struct_literal() => {