mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 15:04:04 +00:00
Support dialect-specific auto-increment column options for MySQL and SQLite (#234)
In MySQL it's AUTO_INCREMENT (see https://dev.mysql.com/doc/refman/8.0/en/create-table.html) and in SQLite it's AUTOINCREMENT. We use `ColumnOption::DialectSpecific(Vec<Token>)` to avoid adding a new variant for each vendor-specific column option.
This commit is contained in:
parent
8020b2e5f0
commit
09ca14fe8e
7 changed files with 95 additions and 5 deletions
|
@ -1283,6 +1283,12 @@ impl Parser {
|
|||
let expr = self.parse_expr()?;
|
||||
self.expect_token(&Token::RParen)?;
|
||||
ColumnOption::Check(expr)
|
||||
} else if self.parse_keyword(Keyword::AUTO_INCREMENT) {
|
||||
// Support AUTO_INCREMENT for MySQL
|
||||
ColumnOption::DialectSpecific(vec![Token::make_keyword("AUTO_INCREMENT")])
|
||||
} else if self.parse_keyword(Keyword::AUTOINCREMENT) {
|
||||
// Support AUTOINCREMENT for SQLite
|
||||
ColumnOption::DialectSpecific(vec![Token::make_keyword("AUTOINCREMENT")])
|
||||
} else {
|
||||
return self.expected("column option", self.peek_token());
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue