mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-11 22:42:02 +00:00
Allow trailing comma in CREATE TABLE
At least MSSQL supports it, not sure about others.
This commit is contained in:
parent
8569a61fd0
commit
0407ed2b57
2 changed files with 12 additions and 11 deletions
|
@ -898,17 +898,12 @@ impl Parser {
|
|||
} else {
|
||||
return self.expected("column name or constraint definition", self.peek_token());
|
||||
}
|
||||
match self.next_token() {
|
||||
Some(Token::Comma) => {}
|
||||
Some(Token::RParen) => {
|
||||
break;
|
||||
}
|
||||
other => {
|
||||
return parser_err!(format!(
|
||||
"Expected ',' or ')' after column definition but found {:?}",
|
||||
other
|
||||
));
|
||||
}
|
||||
let comma = self.consume_token(&Token::Comma);
|
||||
if self.consume_token(&Token::RParen) {
|
||||
// allow a trailing comma, even though it's not in standard
|
||||
break;
|
||||
} else if !comma {
|
||||
return self.expected("',' or ')' after column definition", self.peek_token());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue