mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-11-02 16:21:20 +00:00
Fix parsing CLOB, BINARY, VARBINARY, BLOB data type (#618)
* fix(parser): parse clob, binary, varbinary, blob data type * feat(tests): parse_cast tests for LOB, BINARY datatype
This commit is contained in:
parent
6afd194e94
commit
6c8f31c367
2 changed files with 51 additions and 0 deletions
|
|
@ -3390,6 +3390,10 @@ impl<'a> Parser<'a> {
|
|||
Ok(DataType::Char(self.parse_optional_precision()?))
|
||||
}
|
||||
}
|
||||
Keyword::CLOB => Ok(DataType::Clob(self.parse_precision()?)),
|
||||
Keyword::BINARY => Ok(DataType::Binary(self.parse_precision()?)),
|
||||
Keyword::VARBINARY => Ok(DataType::Varbinary(self.parse_precision()?)),
|
||||
Keyword::BLOB => Ok(DataType::Blob(self.parse_precision()?)),
|
||||
Keyword::UUID => Ok(DataType::Uuid),
|
||||
Keyword::DATE => Ok(DataType::Date),
|
||||
Keyword::DATETIME => Ok(DataType::Datetime),
|
||||
|
|
@ -3603,6 +3607,13 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_precision(&mut self) -> Result<u64, ParserError> {
|
||||
self.expect_token(&Token::LParen)?;
|
||||
let n = self.parse_literal_uint()?;
|
||||
self.expect_token(&Token::RParen)?;
|
||||
Ok(n)
|
||||
}
|
||||
|
||||
pub fn parse_optional_precision(&mut self) -> Result<Option<u64>, ParserError> {
|
||||
if self.consume_token(&Token::LParen) {
|
||||
let n = self.parse_literal_uint()?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue