mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
Backport #62274 to 24.3: Analyzer: Fix alias to parametrized view resolution
This commit is contained in:
parent
74b73ee987
commit
d9528ffad5
@ -7164,7 +7164,9 @@ void QueryAnalyzer::resolveTableFunction(QueryTreeNodePtr & table_function_node,
|
||||
auto parametrized_view_storage = scope_context->getQueryContext()->buildParametrizedViewStorage(function_ast, database_name, table_name);
|
||||
if (parametrized_view_storage)
|
||||
{
|
||||
table_function_node = std::make_shared<TableNode>(parametrized_view_storage, scope_context);
|
||||
auto fake_table_node = std::make_shared<TableNode>(parametrized_view_storage, scope_context);
|
||||
fake_table_node->setAlias(table_function_node->getAlias());
|
||||
table_function_node = fake_table_node;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
@ -0,0 +1,20 @@
|
||||
CREATE TABLE raw_data
|
||||
(
|
||||
`id` UInt8,
|
||||
`data` String
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY id;
|
||||
|
||||
|
||||
INSERT INTO raw_data SELECT number, number
|
||||
FROM numbers(10);
|
||||
|
||||
CREATE VIEW raw_data_parametrized AS
|
||||
SELECT *
|
||||
FROM raw_data
|
||||
WHERE (id >= {id_from:UInt8}) AND (id <= {id_to:UInt8});
|
||||
|
||||
SELECT t1.id
|
||||
FROM raw_data_parametrized(id_from = 0, id_to = 50000) t1
|
||||
ORDER BY t1.id;
|
Loading…
Reference in New Issue
Block a user