mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-22 23:14:07 +00:00
Add support for OFFSET with the ROWS keyword
MySQL doesn't support the ROWS part of OFFSET. Teach the parser to remember which variant it saw, including just ROW.
This commit is contained in:
parent
05a29212ff
commit
c0b0b5924d
4 changed files with 96 additions and 25 deletions
|
@ -1970,10 +1970,16 @@ impl Parser {
|
|||
}
|
||||
|
||||
/// Parse an OFFSET clause
|
||||
pub fn parse_offset(&mut self) -> Result<Expr, ParserError> {
|
||||
pub fn parse_offset(&mut self) -> Result<Offset, ParserError> {
|
||||
let value = Expr::Value(self.parse_number_value()?);
|
||||
self.expect_one_of_keywords(&["ROW", "ROWS"])?;
|
||||
Ok(value)
|
||||
let rows = if self.parse_keyword("ROW") {
|
||||
OffsetRows::Row
|
||||
} else if self.parse_keyword("ROWS") {
|
||||
OffsetRows::Rows
|
||||
} else {
|
||||
OffsetRows::None
|
||||
};
|
||||
Ok(Offset { value, rows })
|
||||
}
|
||||
|
||||
/// Parse a FETCH clause
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue