mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-19 16:20:50 +00:00
Merge c5e866cd75
into b94a7167a8
This commit is contained in:
commit
873ce7522f
@ -106,7 +106,7 @@ bool ParserSelectQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
{
|
||||
select_query->recursive_with = s_recursive.ignore(pos, expected);
|
||||
|
||||
if (!ParserList(std::make_unique<ParserWithElement>(), std::make_unique<ParserToken>(TokenType::Comma))
|
||||
if (!ParserList(std::make_unique<ParserWithElement>(select_query->recursive_with), std::make_unique<ParserToken>(TokenType::Comma))
|
||||
.parse(pos, with_expression_list, expected))
|
||||
return false;
|
||||
if (with_expression_list->children.empty())
|
||||
|
@ -26,6 +26,10 @@ bool ParserWithElement::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
with_element->children.push_back(with_element->subquery);
|
||||
node = with_element;
|
||||
}
|
||||
else if (with_recursive)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = old_pos;
|
||||
|
@ -10,9 +10,14 @@ namespace DB
|
||||
*/
|
||||
class ParserWithElement : public IParserBase
|
||||
{
|
||||
public:
|
||||
explicit ParserWithElement(bool with_recursive_ = false) : with_recursive(with_recursive_) {}
|
||||
protected:
|
||||
const char * getName() const override { return "WITH element"; }
|
||||
bool parseImpl(Pos & pos, ASTPtr & node, Expected & expected) override;
|
||||
|
||||
/// for `WITH RECURSIVE` CTE, we don't allow expression with alias.
|
||||
bool with_recursive;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,2 @@
|
||||
drop table if exists t;
|
||||
create view t AS (WITH RECURSIVE 42 as ttt SELECT ttt) -- { clientError SYNTAX_ERROR };
|
Loading…
Reference in New Issue
Block a user