mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
ISSUES-1682 support insert into with select
This commit is contained in:
parent
ccf7c1f760
commit
2e54dcf9b6
@ -33,6 +33,7 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
ParserKeyword s_values("VALUES");
|
||||
ParserKeyword s_format("FORMAT");
|
||||
ParserKeyword s_select("SELECT");
|
||||
ParserKeyword s_with("WITH");
|
||||
ParserToken s_lparen(TokenType::OpeningRoundBracket);
|
||||
ParserToken s_rparen(TokenType::ClosingRoundBracket);
|
||||
ParserIdentifier name_p;
|
||||
@ -119,7 +120,7 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
if (data < end && *data == '\n')
|
||||
++data;
|
||||
}
|
||||
else if (s_select.ignore(pos, expected))
|
||||
else if (s_select.ignore(pos, expected) || s_with.ignore(pos,expected))
|
||||
{
|
||||
pos = before_select;
|
||||
ParserSelectQuery select_p;
|
||||
|
@ -0,0 +1,3 @@
|
||||
0 0
|
||||
1 2
|
||||
2 4
|
@ -0,0 +1,9 @@
|
||||
DROP TABLE IF EXISTS test.test;
|
||||
|
||||
CREATE TABLE test.test(number UInt64, num2 UInt64) ENGINE = Log;
|
||||
|
||||
INSERT INTO test.test WITH number * 2 AS num2 SELECT number, num2 FROM system.numbers LIMIT 3;
|
||||
|
||||
SELECT * FROM test.test;
|
||||
|
||||
DROP TABLE test.test;
|
Loading…
Reference in New Issue
Block a user