mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 07:01:59 +00:00
Fix enable_global_with_statement setting support
This commit is contained in:
parent
aa1c181731
commit
9664dc36b6
@ -1323,7 +1323,9 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifierInParentScopes(const
|
||||
*
|
||||
* Example: SELECT arrayMap(x -> test_table.* EXCEPT value, [1,2,3]) FROM test_table;
|
||||
*/
|
||||
if (identifier_lookup.isTableExpressionLookup() && initial_scope_is_query)
|
||||
if (initial_scope_is_query)
|
||||
{
|
||||
if (identifier_lookup.isTableExpressionLookup())
|
||||
{
|
||||
new_resolve_context.allow_to_check_join_tree = false;
|
||||
|
||||
@ -1336,6 +1338,13 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifierInParentScopes(const
|
||||
new_resolve_context.allow_to_check_aliases = false;
|
||||
}
|
||||
|
||||
if (!scope.context->getSettingsRef()[Setting::enable_global_with_statement])
|
||||
{
|
||||
new_resolve_context.allow_to_check_aliases = false;
|
||||
new_resolve_context.allow_to_check_cte = false;
|
||||
}
|
||||
}
|
||||
|
||||
new_resolve_context.allow_to_check_database_catalog = false;
|
||||
|
||||
LOG_DEBUG(&Poco::Logger::get("resolveInParentScope"), "Another SCOPE TO RESOLVE EXPRESSIONS: {}", new_resolve_context.scope_to_resolve_alias_expression != nullptr);
|
||||
@ -1348,9 +1357,6 @@ IdentifierResolveResult QueryAnalyzer::tryResolveIdentifierInParentScopes(const
|
||||
|
||||
LOG_DEBUG(&Poco::Logger::get("resolveInParentScope"), "Resolved indetifier '{}':\n{}", identifier_lookup.dump(), resolved_identifier->dumpTree());
|
||||
|
||||
if (!scope.context->getSettingsRef()[Setting::enable_global_with_statement] && (resolve_result.isResolvedFromAliases() || resolve_result.isResolvedFromCTEs()))
|
||||
return {};
|
||||
|
||||
/** From parent scopes we can resolve table identifiers only as CTE.
|
||||
* Example: SELECT (SELECT 1 FROM a) FROM test_table AS a;
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user