mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-12 23:12:01 +00:00
Add lateral derived support
This commit is contained in:
parent
fe10fac0ad
commit
2d00ea7187
3 changed files with 63 additions and 3 deletions
|
@ -1464,11 +1464,18 @@ impl Parser {
|
|||
|
||||
/// A table name or a parenthesized subquery, followed by optional `[AS] alias`
|
||||
pub fn parse_table_factor(&mut self) -> Result<TableFactor, ParserError> {
|
||||
let lateral = self.parse_keyword("LATERAL");
|
||||
if self.consume_token(&Token::LParen) {
|
||||
let subquery = Box::new(self.parse_query()?);
|
||||
self.expect_token(&Token::RParen)?;
|
||||
let alias = self.parse_optional_alias(keywords::RESERVED_FOR_TABLE_ALIAS)?;
|
||||
Ok(TableFactor::Derived { subquery, alias })
|
||||
Ok(TableFactor::Derived {
|
||||
lateral,
|
||||
subquery,
|
||||
alias,
|
||||
})
|
||||
} else if lateral {
|
||||
self.expected("subquery after LATERAL", self.peek_token())
|
||||
} else {
|
||||
let name = self.parse_object_name()?;
|
||||
// Postgres, MSSQL: table-valued functions:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue