v.20.10New Feature
Introduce enable_global_with_statement to Propagate WITH Statements in Select Queries
Introduceenable_global_with_statementsetting which propagates the first select'sWITHstatements to other select queries at the same level, and makes aliases inWITHstatements visible to subqueries. #15451 (Amos Bird).
Why it matters
This feature addresses the limitation whereWITH expressions and their aliases are scoped only to the individual SELECT statement they are defined in. By enabling this setting, users can define common aliases once and have them automatically available across multiple queries at the same nesting level and within subqueries, improving query readability and reducing redundancy.How to use it
To use this feature, set the configuration optionenable_global_with_statement to 1 or true in your ClickHouse session or configuration file. This will activate global propagation of WITH aliases for queries executed within the session.