mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-06 06:00:32 +00:00
Parse an optional column list after a CTE
This commit is contained in:
parent
f859c9b80e
commit
cccf7f0d8e
3 changed files with 40 additions and 11 deletions
|
@ -1215,12 +1215,19 @@ impl Parser {
|
|||
let mut cte = vec![];
|
||||
loop {
|
||||
let alias = self.parse_identifier()?;
|
||||
// TODO: Optional `( <column list> )`
|
||||
let renamed_columns = if self.consume_token(&Token::LParen) {
|
||||
let cols = self.parse_column_names()?;
|
||||
self.expect_token(&Token::RParen)?;
|
||||
cols
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
self.expect_keyword("AS")?;
|
||||
self.expect_token(&Token::LParen)?;
|
||||
cte.push(Cte {
|
||||
alias,
|
||||
query: self.parse_query()?,
|
||||
renamed_columns,
|
||||
});
|
||||
self.expect_token(&Token::RParen)?;
|
||||
if !self.consume_token(&Token::Comma) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue