mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 05:30:19 +00:00
Support COLLATION
keywork on CREATE TABLE
(#424)
* support table definition's collate * add table collate test
This commit is contained in:
parent
b5f37118f1
commit
2ebe18a94e
3 changed files with 43 additions and 0 deletions
|
@ -1560,6 +1560,7 @@ impl<'a> Parser<'a> {
|
|||
like: None,
|
||||
default_charset: None,
|
||||
engine: None,
|
||||
collation: None,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1754,6 +1755,16 @@ impl<'a> Parser<'a> {
|
|||
None
|
||||
};
|
||||
|
||||
let collation = if self.parse_keywords(&[Keyword::COLLATE]) {
|
||||
self.expect_token(&Token::Eq)?;
|
||||
match self.next_token() {
|
||||
Token::Word(w) => Some(w.value),
|
||||
unexpected => self.expected("identifier", unexpected)?,
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Ok(Statement::CreateTable {
|
||||
name: table_name,
|
||||
temporary,
|
||||
|
@ -1773,6 +1784,7 @@ impl<'a> Parser<'a> {
|
|||
like,
|
||||
engine,
|
||||
default_charset,
|
||||
collation,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue