Skip to content

Commit

Permalink
Box Query in Cte (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
MazterQyou committed Sep 27, 2022
1 parent 39761b0 commit 0724ef1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ast/query.rs
Expand Up @@ -271,7 +271,7 @@ impl fmt::Display for With {
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Cte {
pub alias: TableAlias,
pub query: Query,
pub query: Box<Query>,
pub from: Option<Ident>,
}

Expand Down
4 changes: 2 additions & 2 deletions src/parser.rs
Expand Up @@ -3550,7 +3550,7 @@ impl<'a> Parser<'a> {

let mut cte = if self.parse_keyword(Keyword::AS) {
self.expect_token(&Token::LParen)?;
let query = self.parse_query()?;
let query = Box::new(self.parse_query()?);
self.expect_token(&Token::RParen)?;
let alias = TableAlias {
name,
Expand All @@ -3565,7 +3565,7 @@ impl<'a> Parser<'a> {
let columns = self.parse_parenthesized_column_list(Optional)?;
self.expect_keyword(Keyword::AS)?;
self.expect_token(&Token::LParen)?;
let query = self.parse_query()?;
let query = Box::new(self.parse_query()?);
self.expect_token(&Token::RParen)?;
let alias = TableAlias { name, columns };
Cte {
Expand Down
2 changes: 1 addition & 1 deletion tests/sqlparser_common.rs
Expand Up @@ -3861,7 +3861,7 @@ fn parse_recursive_cte() {
quote_style: None,
}],
},
query: cte_query,
query: Box::new(cte_query),
from: None,
};
assert_eq!(with.cte_tables.first().unwrap(), &expected);
Expand Down

0 comments on commit 0724ef1

Please sign in to comment.