mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-09 23:46:20 +00:00
feat: add FULLTEXT option on create table for MySQL and Generic dialects (#702)
This commit is contained in:
parent
87b4a168cb
commit
cdf4447065
5 changed files with 161 additions and 6 deletions
|
@ -3085,6 +3085,38 @@ impl<'a> Parser<'a> {
|
|||
columns,
|
||||
}))
|
||||
}
|
||||
Token::Word(w)
|
||||
if (w.keyword == Keyword::FULLTEXT || w.keyword == Keyword::SPATIAL)
|
||||
&& dialect_of!(self is GenericDialect | MySqlDialect) =>
|
||||
{
|
||||
if let Some(name) = name {
|
||||
return self.expected(
|
||||
"FULLTEXT or SPATIAL option without constraint name",
|
||||
Token::make_keyword(&name.to_string()),
|
||||
);
|
||||
}
|
||||
|
||||
let fulltext = w.keyword == Keyword::FULLTEXT;
|
||||
|
||||
let index_type_display = if self.parse_keyword(Keyword::KEY) {
|
||||
KeyOrIndexDisplay::Key
|
||||
} else if self.parse_keyword(Keyword::INDEX) {
|
||||
KeyOrIndexDisplay::Index
|
||||
} else {
|
||||
KeyOrIndexDisplay::None
|
||||
};
|
||||
|
||||
let opt_index_name = self.maybe_parse(|parser| parser.parse_identifier());
|
||||
|
||||
let columns = self.parse_parenthesized_column_list(Mandatory)?;
|
||||
|
||||
Ok(Some(TableConstraint::FulltextOrSpatial {
|
||||
fulltext,
|
||||
index_type_display,
|
||||
opt_index_name,
|
||||
columns,
|
||||
}))
|
||||
}
|
||||
unexpected => {
|
||||
if name.is_some() {
|
||||
self.expected("PRIMARY, UNIQUE, FOREIGN, or CHECK", unexpected)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue