mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-15 20:24:07 +00:00
add test
This commit is contained in:
parent
4de51aaf4d
commit
0979723a51
@ -186,8 +186,13 @@ bool ParserInsertQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
{
|
||||
const auto & children = select->as<ASTSelectWithUnionQuery>()->list_of_selects->children;
|
||||
for (const auto & child : children)
|
||||
{
|
||||
if (child->as<ASTSelectQuery>()->getExpression(ASTSelectQuery::Expression::WITH, false))
|
||||
throw Exception(ErrorCodes::SYNTAX_ERROR,
|
||||
"Only one WITH should be presented, either before INSERT or SELECT.");
|
||||
child->as<ASTSelectQuery>()->setExpression(ASTSelectQuery::Expression::WITH,
|
||||
std::move(with_expression_list));
|
||||
}
|
||||
}
|
||||
|
||||
/// FORMAT section is expected if we have input() in SELECT part
|
||||
|
@ -8,3 +8,13 @@
|
||||
2
|
||||
3
|
||||
4
|
||||
2025-01-01
|
||||
2026-01-01
|
||||
2027-01-01
|
||||
2028-01-01
|
||||
2029-01-01
|
||||
2030-01-01
|
||||
2031-01-01
|
||||
2032-01-01
|
||||
2033-01-01
|
||||
2034-01-01
|
||||
|
@ -28,4 +28,35 @@ INTERSECT
|
||||
SELECT *
|
||||
FROM y;
|
||||
|
||||
SELECT * FROM x;
|
||||
SELECT * FROM x;
|
||||
|
||||
WITH y AS
|
||||
(
|
||||
SELECT *
|
||||
FROM numbers(10)
|
||||
)
|
||||
INSERT INTO x
|
||||
WITH y2 AS
|
||||
(
|
||||
SELECT *
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT * FROM y; -- { clientError SYNTAX_ERROR }
|
||||
|
||||
DROP TABLE x;
|
||||
|
||||
CREATE TABLE x (d date) ENGINE = Log;
|
||||
|
||||
WITH y AS
|
||||
(
|
||||
SELECT
|
||||
number,
|
||||
date_add(YEAR, number, toDate('2025-01-01')) AS new_date
|
||||
FROM numbers(10)
|
||||
)
|
||||
INSERT INTO x
|
||||
SELECT y.new_date FROM y;
|
||||
|
||||
SELECT * FROM x;
|
||||
|
||||
DROP TABLE x;
|
Loading…
Reference in New Issue
Block a user